Thursday, 14 January 2016

logical deduction - 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?



Answer



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


No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...