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.

A317422 a(n) is the smallest positive integer such that with the letters of the name of that number we can spell the name of exactly n smaller positive integers.

This page as a plain text file.
%I A317422 #37 Aug 19 2022 13:52:43
%S A317422 15,13,14,21,24,72,76,74,113,115,121,171,122,150,131,142,127,147,124,
%T A317422 129,159,138,135,153,137,156,126,125,128,165,168,157,158,467,289,265,
%U A317422 267,487,275,392,278,754,692,492,257,857,572,524,674,428,1133,748,1322,867
%N A317422 a(n) is the smallest positive integer such that with the letters of the name of that number we can spell the name of exactly n smaller positive integers.
%C A317422 a(2065) > 100000. - _Hans Havermann_, Aug 10 2018
%D A317422 Sequence Fans Mailing list.
%H A317422 Michael S. Branicky, <a href="/A317422/b317422.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..2064 from Hans Havermann, terms 1..100 from Daniel Suteu)
%e A317422 a(1) = 15 because with the letters of 'fifteen' we can write only one smaller number: ten. And 15 is the smallest number for which this is so. (We cannot write 'nine' because that requires two letters 'n'.)
%e A317422 a(10) = 115 because with the letters of 'one hundred fifteen' we can write the name of ten smaller numbers: one, three, four, nine, ten, fourteen, fifteen, nineteen, one hundred, one hundred ten.
%o A317422 (Python)
%o A317422 from num2words import num2words as n2w
%o A317422 from collections import Counter
%o A317422 from itertools import count, islice
%o A317422 def key(n):
%o A317422     return Counter(c for c in n2w(n).replace(" and", "") if c.isalpha())
%o A317422 def included(c1, c2): # in Python 3.10+, use c[i] <= c[k] in agen()
%o A317422     return all(c1[c] <= c2[c] for c in c1)
%o A317422 def agen():
%o A317422     n, adict, c = 1, {0: 1}, [None]
%o A317422     for k in count(1):
%o A317422         c.append(key(k))
%o A317422         v = sum(1 for i in range(1, k) if included(c[i], c[k]))
%o A317422         if v not in adict: adict[v] = k
%o A317422         while n in adict: yield adict[n]; n += 1
%o A317422         if k%10000 == 0:
%o A317422             print("...", k)
%o A317422 print(list(islice(agen(), 54))) # _Michael S. Branicky_, Aug 19 2022
%Y A317422 Cf. A317423 (Spanish).
%K A317422 nonn,word
%O A317422 1,1
%A A317422 _Claudio Meller_, Jul 27 2018