A164791 a(n) is the smallest nonnegative number whose American English name has the letter "n" in the n-th position.
9, 1, 9, 20, 7, 11, 15, 13, 17, 47, 27, 77, 109, 120, 107, 111, 115, 113, 117, 147, 127, 177, 327, 377, 1120, 1107, 1111, 1115, 1113, 1117, 1147, 1127, 1177, 1327, 1377, 3327, 3377, 11377, 13327, 13377, 17377, 23327, 23377, 73377, 101377, 103327, 103377
Offset: 1
Examples
a(1)=9 ("Nine"), a(2)=1 ("oNe"), a(3)=9 ("niNe"), a(4)=20 ("tweNty").
References
- GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 70.
Crossrefs
Programs
-
Python
from num2words import num2words from itertools import count, islice def n2w(n): return "".join(c for c in num2words(n).replace(" and", "") if c.isalpha()) def a(n): return next(i for i in count(0) if len(w:=n2w(i))>=n and w[n-1]=="n") print([a(n) for n in range(1, 41)]) # Michael S. Branicky, Apr 21 2023
-
Python
# faster for initial segment of sequence; uses n2w, imports above def agen(): # generator of terms adict, n = dict(), 1 for i in count(0): w = n2w(i) if "n" in w: locs = [i+1 for i, c in enumerate(w) if w[i] == "n"] for v in locs: if v not in adict: adict[v] = i while n in adict: yield adict[n]; n += 1 print(list(islice(agen(), 50))) # Michael S. Branicky, Apr 21 2023
Extensions
a(25) and beyond from Michael S. Branicky, Mar 25 2021
Definition clarified by N. J. A. Sloane, Apr 20 2023. We also need a British English analog of this, just as A362121 is an analog of A164790 (a(13) will be different).
Comments