29
$\begingroup$

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?

$\endgroup$
4
  • 1
    $\begingroup$ First "uneven" number? Doesn't that just mean the first odd number? (And wouldn't that be 1?) $\endgroup$
    – Doorknob
    Commented Jul 31, 2014 at 12:44
  • 1
    $\begingroup$ Oh, I see. How are the numbers written out? (For example, does 1000 become "one thousand" or "a thousand" or "thousand" or...?) $\endgroup$
    – Doorknob
    Commented Jul 31, 2014 at 12:47
  • $\begingroup$ Is the (sub-)phrase "eighteenhundred" allowed or can eighteen only be in front of million and thousand? $\endgroup$
    – Ruluhulu
    Commented Jul 31, 2014 at 13:54
  • $\begingroup$ 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. ;) ) $\endgroup$
    – Ruluhulu
    Commented Jul 31, 2014 at 14:31

5 Answers 5

29
$\begingroup$

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).

P.S. https://oeis.org/A108067

$\endgroup$
0
16
$\begingroup$

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

$\endgroup$
4
  • 2
    $\begingroup$ Why is this accepted when it's without explanation and relying on unproven claim? $\endgroup$
    – justhalf
    Commented Aug 1, 2014 at 1:48
  • $\begingroup$ I would argue that @Gilles has proved the claim, which is one reason I've voted his answer up. $\endgroup$ Commented Aug 1, 2014 at 13:11
  • $\begingroup$ Ah, I didn't see Gilles' answer. Then I believe his answer is more suited to be accepted. Don't you think so? =) $\endgroup$
    – justhalf
    Commented Aug 1, 2014 at 13:41
  • 2
    $\begingroup$ 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. $\endgroup$ Commented Aug 1, 2014 at 13:46
4
$\begingroup$
  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.

$\endgroup$
8
  • $\begingroup$ 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"? $\endgroup$
    – Kevin
    Commented Jul 31, 2014 at 13:07
  • $\begingroup$ @Kevin Whoops, you're right, edited. (I'm now on mobile getting ready to leave somewhere; sorry for the delay) $\endgroup$
    – Doorknob
    Commented Jul 31, 2014 at 13:19
  • 3
    $\begingroup$ @JoeZ.: that is even $\endgroup$ Commented Jul 31, 2014 at 15:38
  • 1
    $\begingroup$ As noted by Kevin, …eighteen… beats …eighthundred…. $\endgroup$ Commented Jul 31, 2014 at 15:41
  • 1
    $\begingroup$ @RossMillikan Right you are, I completely missed that. $\endgroup$
    – user88
    Commented Aug 1, 2014 at 3:55
3
$\begingroup$

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
$\endgroup$
2
$\begingroup$

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.

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.