login
Position of integer n in the list of first n natural numbers written out in English (without "and") and arranged in alphabetical order.
2

%I #19 Jan 02 2026 04:37:08

%S 1,2,2,1,1,4,4,1,4,8,2,11,10,5,3,11,10,2,9,19,20,21,21,20,20,23,23,20,

%T 23,17,18,19,19,18,18,21,21,18,21,6,7,8,8,7,7,10,10,7,10,5,6,7,7,6,6,

%U 9,9,6,9,35,36,37,37,36,36,39,39,36,39,33,34,35,35,34,34,37,37,34,37,3,4,5,5

%N Position of integer n in the list of first n natural numbers written out in English (without "and") and arranged in alphabetical order.

%C In going to higher terms, we use the conventions in A005589: spaces, hyphens and commas are removed before sorting. Thus, a(800) = 3 from EIGHT, EIGHTEEN, EIGHTHUNDRED, ..., not 2 from EIGHT, EIGHT HUNDRED, EIGHTEEN, ... . - _Michael S. Branicky_, Dec 28 2025

%H Michael S. Branicky, <a href="/A108017/b108017.txt">Table of n, a(n) for n = 1..10000</a>

%e a(19) = 9 because of the ordered list: EIGHT, EIGHTEEN, ELEVEN, FIFTEEN, FIVE, FOUR, FOURTEEN, NINE, NINETEEN, ..., TWELVE, TWO.

%e a(21) = 20 because of the ordered list: EIGHT, ..., TWENTY, TWENTYONE, TWO.

%o (Python)

%o from num2words import num2words

%o from bisect import bisect, insort

%o from itertools import count, islice

%o def agen(): # generator of terms

%o s = [""]

%o for n in count(1):

%o sn = "".join(c for c in num2words(n).replace(" and","") if c.isalpha())

%o an = bisect(s, sn)

%o insort(s, sn)

%o yield an

%o print(list(islice(agen(), 83))) # _Michael S. Branicky_, Dec 28 2025

%Y Cf. A005589, A214095 (in French).

%K nonn,word

%O 1,2

%A _Lekraj Beedassy_, May 31 2005

%E a(21) onward corrected by _Michael S. Branicky_, Dec 28 2025