OFFSET
1,1
REFERENCES
GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 70.
EXAMPLE
a(1)=8 ("Eight"), a(2)=0 ("zEro"), a(3)=1 ("onE"), a(4)=3 ("thrEe").
PROG
(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 A164790(n, t="e", i0=0): # t is target letter, i0 is start
return next(i for i in count(i0) if len(w:=n2w(i))>=n and w[n-1]==t)
print([A164790(n) for n in range(1, 38)]) # Michael S. Branicky, Apr 21 2023
(Python) # faster for initial segment of sequence; uses n2w/imports above
def A164790gen(t="e", i0=0, offset=1): # generator of terms w
adict, n = dict(), offset
for i in count(i0):
w = n2w(i)
if t in w:
locs = [i+1 for i, c in enumerate(w) if w[i] == t]
for v in locs:
if v not in adict: adict[v] = i
while n in adict: yield adict[n]; n += 1
print(list(islice(A164790gen(), 50))) # Michael S. Branicky, Apr 21 2023
CROSSREFS
KEYWORD
nonn,word
AUTHOR
Claudio Meller, Aug 26 2009
EXTENSIONS
a(25) and beyond from Michael S. Branicky, Mar 25 2021
Name edited by N. J. A. Sloane, Apr 20 2023
STATUS
approved