# First odd number in a “number dictionary”

All numbers between 1 and 1010 are written out and ordered alphabetically into a dictionary (as the only entries).

Spaces and hyphens are removed. 1024 would then be "onethousandtwentyfour".
Also, "and" is not being used as a link (I think that's American English).
Furthermore, the American number scale is used: million, billion, trillion...

Myriad is not used, and numbers with (or like) 1984 are composed with "onethousand",
so "nineteeneightyfour" would not be allowed.
Last but not least: the numbers are written out in, well, (American) English.

What is the first odd number?

Bonus question: What is the first prime number?

• First "uneven" number? Doesn't that just mean the first odd number? (And wouldn't that be 1?) – Doorknob Jul 31 '14 at 12:44
• Oh, I see. How are the numbers written out? (For example, does 1000 become "one thousand" or "a thousand" or "thousand" or...?) – Doorknob Jul 31 '14 at 12:47
• Is the (sub-)phrase "eighteenhundred" allowed or can eighteen only be in front of million and thousand? – Ruluhulu Jul 31 '14 at 13:54
• Maybe you could clarify the question a bit more by adding they are written out in English. (Otherwise I think the Dutch 'achtduizenddrie' (8003) is a good contender as well. ;) ) – Ruluhulu Jul 31 '14 at 14:31

Number words in the given range are assembled from the following components:

• The set $A$ of single digits: eight, five, four, nine, one, seven, six, three, two.
• The set $B$ of double-digit blocks: eighteen, eleven, fifteen, fourteen, nineteen, seventeen, sixteen, thirteen, twelve.
• The set $C$ of tens digits: eighty, fifty, forty, ninety, seventy, sixty, thirty, twenty.
• hundred
• The powers of 1000: billion, million, thousand.

Number words are generated by the following non-ambiguous grammar (I use the abbreviated notation $X^?$ to mean $X$ or nothing): $$\begin{array}{lllll} S \to & & & T \, \texttt{thousand} & T^? \\ S \to & & T \, \texttt{million} & & T^? \\ S \to & & T \, \texttt{million} & T \, \texttt{thousand} & T^? \\ S \to & A \, \texttt{billion} & & & T^? \\ S \to & A \, \texttt{billion} & & T \, \texttt{thousand} & T^? \\ S \to & A \, \texttt{billion} & T \, \texttt{million} & & T^? \\ S \to & A \, \texttt{billion} & T \, \texttt{million} & T \, \texttt{thousand} & T^? \\ T \to & & A \\ T \to & & B \\ T \to & & C \, A^? \\ T \to & A \, \texttt{hundred} & B \\ T \to & A \, \texttt{hundred} & C^? \, A^? \\ \end{array}$$

The constraint that the number is odd implies that the rightmost non-terminal will be $A$ or $B$ (otherwise the number is a multiple of $10$). Every production that has $A$ or $B$ at the rightmost position allows the rightmost non-terminals to be $A$, $B$, or $C \, A$. The first odd $A$ is five, the first odd $B$ is eleven, and the first odd $C \, A$ is eightyfive. The winner is eightyfive: that's the first odd number in the range $[1,99]$, and that's how the first odd number ends.

Going left, eighthundred competes with leaving out the $A \, \texttt{hundred}$ part. Since eighthundred comes before eightyfive, the first number ends with eighthundredeightyfive (which is the first odd number in the range $[1,999]$).

For the other occurrences of $T$ (in front of thousand and million), we don't have the constraint that the number must be odd. There eight followed by a power of 1000 competes with eighteen (which beats eighthundred…); for both thousand and million, eighteen wins. If billion appears, then the first member of $A$ (eight) is in front. Thus the following numbers compete:

                                              eighthundredeightyfive
eighteenthousand eighthundredeightyfive
eighteenmillion                  eighthundredeightyfive
eighteenmillion eighteenthousand eighthundredeightyfive
eightbillion                                  eighthundredeightyfive
eightbillion                 eighteenthousand eighthundredeightyfive
eightbillion eighteenmillion                  eighthundredeightyfive
eightbillion eighteenmillion eighteenthousand eighthundredeightyfive


eightbillion wins against eighteen…. As for the powers of 1000 to include prefixed by eighteen when they all start after een, pick the first one in alphabetical order, then the first one that's numerically smaller, and so on. Or, with only four possibilities, you can check manually.

The winner is:

eightbillion eighteenmillion eighteenthousand eighthundredeightyfive


or 8,018,018,885 for short. This would still be the first word for an odd number if the dictionary included all number words with conventionally-accepted names (in U.S. English, without and).

Under the belief that Kevin has the correct answer with

8,018,018,885

I decided to look at the bonus. Pulling the prime numbers from http://www.primos.mat.br/, #37 (includes all primes that start with eightbillioneighteenmillion), there are 4 primes that start with eightbillioneighteenmillioneighteenthousandeighthundred:

8,018,018,819
8,018,018,849
8,018,018,851
8,018,018,893

Of those, the first alphabetically is in bold, and is written out as:

eightbillioneighteenmillioneighteenthousandeighthundredfiftyone

• Why is this accepted when it's without explanation and relying on unproven claim? – justhalf Aug 1 '14 at 1:48
• I would argue that @Gilles has proved the claim, which is one reason I've voted his answer up. – Joel Rondeau Aug 1 '14 at 13:11
• Ah, I didn't see Gilles' answer. Then I believe his answer is more suited to be accepted. Don't you think so? =) – justhalf Aug 1 '14 at 13:41
• Yes. I was surprised this answer was marked as accepted, as I was really just going for the bonus. It OP wants to change it, I won't be disappointed. Was a fun puzzle. – Joel Rondeau Aug 1 '14 at 13:46
1. We know that the numbers go from "one" to "tenbillion."

2. We also know that the only phrases that can appear in this dictionary are: one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, thirty, forty, fifty, sixty, seventy, eighty, ninety, hundred, thousand, million, billion.

• This list was found by concatenating: The list of numbers 1-10, the list of "special" numbers 11-19, the list of "tens place numbers" 10-90, and the list of "scales" 100, 1000, ....
3. Sorted alphabetically, that becomes: billion, eight, eighteen, eighty, eleven, fifteen, fifty, five, forty, four, fourteen, hundred, million, nine, nineteen, ninety, one, seven, seventeen, seventy, six, sixteen, sixty, ten, thirteen, thirty, thousand, three, twelve, twenty, two.

4. A number cannot start with "billion," so that leaves "eight" as the first "segment" of the number we're looking for. (This still technically leaves the problem of what would happen if a shorter "segment" that appears later in the list had, for example, "billion" added to it, but the shortest segment that comes after "eight" is "five," and "fivebillion" sorts after "eight.")

5. The number has to be odd, and eight is not odd, so something has to be appended. "Billion" is the obvious choice as it is the first item in the list.

6. Now, the number needs to have an odd ending. We can continue appending to it, though. "Eightbillionbillion" doesn't make sense, so it can become...

• "Eightbillioneight"
• "Eightbillioneighthundred"
• "Eightbillioneighthundredeight"
• ... uh oh, we can't append anything else while still having a valid number
7. The last digit has to be odd, so change the "eight" to the next odd digit, "five."

Therefore, the first odd number in this dictionary is "eightbillioneighthundredfive" or 8,000,000,805.

• I'm with you up to step five, but I think you jumped the gun on choosing the best ending segment. Isn't "eightbillioneighthundredeightyfive" better than "eightbillionfive"? – Kevin Jul 31 '14 at 13:07
• @Kevin Whoops, you're right, edited. (I'm now on mobile getting ready to leave somewhere; sorry for the delay) – Doorknob Jul 31 '14 at 13:19
• @JoeZ.: that is even – Ross Millikan Jul 31 '14 at 15:38
• As noted by Kevin, …eighteen… beats …eighthundred…. – Gilles 'SO- stop being evil' Jul 31 '14 at 15:41
• @RossMillikan Right you are, I completely missed that. – Joe Z. Aug 1 '14 at 3:55

For the bonus question, the following python code can be used to find (or verify) the set of primes in the range 8018018800 to 8018018900 (a range found to be relevant by reasoning as in previous answers), the winning number being 8018018851. If there had been no suitable primes in that first range, one could then have looked at ranges like 8018018500 to 8018018600 or 8018018400 to 8018018500, or even the whole range 8018018000 to 8018019000, to find candidates like 8018018581 or 8018018447 or 8018018081.

#!/usr/bin/env python
from gmpy import next_prime
v = next_prime(8018018800)
while 1:
print v
v = next_prime(v)
if v > 8018018900: break


Output:

8018018819
8018018849
8018018851
8018018893


Using Doorknobs reasoning, I come to eightbillioneighteenmillioneighteenthousandeighthundredfive or, if that is possible in English eightbillioneighteenhundredfive

Edited to remove the 'ands' but the example in the question '1024 would then be "onethousandfortytwo"' is a bit misleading.

Edited again: last bit was my mistake by not reading thoroughly enough.

• No "and"s allowed :-) – Kevin Jul 31 '14 at 13:21
• Why is it misleading? – 355durch113 Jul 31 '14 at 13:26
• I think eightbillioneighteenmillioneighteenthousandeighthundredeightyfive beats eightbillioneighteenmillioneighteenthousandeighthundredfive. – Kevin Jul 31 '14 at 13:26
• @Carlster, skimming quickly, one might see the character sequence "and" in "thousand", and assume "and"s are permitted. – Kevin Jul 31 '14 at 13:27
• @Kevin would you not like to post eightbillioneighteenmillioneighteenthousandeighthundredeightyfive as an answer? – Ruluhulu Jul 31 '14 at 13:38

## protected by Community♦Aug 1 '18 at 13:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).