cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A164791 a(n) is the smallest nonnegative number whose American English name has the letter "n" in the n-th position.

This page as a plain text file.
%I A164791 #21 Apr 21 2023 11:37:54
%S A164791 9,1,9,20,7,11,15,13,17,47,27,77,109,120,107,111,115,113,117,147,127,
%T A164791 177,327,377,1120,1107,1111,1115,1113,1117,1147,1127,1177,1327,1377,
%U A164791 3327,3377,11377,13327,13377,17377,23327,23377,73377,101377,103327,103377
%N A164791 a(n) is the smallest nonnegative number whose American English name has the letter "n" in the n-th position.
%D A164791 GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 70.
%e A164791 a(1)=9 ("Nine"), a(2)=1 ("oNe"), a(3)=9 ("niNe"), a(4)=20 ("tweNty").
%o A164791 (Python)
%o A164791 from num2words import num2words
%o A164791 from itertools import count, islice
%o A164791 def n2w(n):
%o A164791   return "".join(c for c in num2words(n).replace(" and", "") if c.isalpha())
%o A164791 def a(n):
%o A164791     return next(i for i in count(0) if len(w:=n2w(i))>=n and w[n-1]=="n")
%o A164791 print([a(n) for n in range(1, 41)]) # _Michael S. Branicky_, Apr 21 2023
%o A164791 (Python) # faster for initial segment of sequence; uses n2w, imports above
%o A164791 def agen(): # generator of terms
%o A164791     adict, n = dict(), 1
%o A164791     for i in count(0):
%o A164791         w = n2w(i)
%o A164791         if "n" in w:
%o A164791             locs = [i+1 for i, c in enumerate(w) if w[i] == "n"]
%o A164791             for v in locs:
%o A164791                 if v not in adict: adict[v] = i
%o A164791         while n in adict: yield adict[n]; n += 1
%o A164791 print(list(islice(agen(), 50))) # _Michael S. Branicky_, Apr 21 2023
%Y A164791 Cf. A164789 ("o"), A164790 ("e"), A164792 ("t"), A164793 ("i"), A164794 ("f"), A164795 ("h"), A164796 ("r"), A164797 ("u").
%K A164791 nonn,word
%O A164791 1,1
%A A164791 _Claudio Meller_, Aug 26 2009
%E A164791 a(25) and beyond from _Michael S. Branicky_, Mar 25 2021
%E A164791 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).