%I #37 Aug 19 2022 13:52:43
%S 15,13,14,21,24,72,76,74,113,115,121,171,122,150,131,142,127,147,124,
%T 129,159,138,135,153,137,156,126,125,128,165,168,157,158,467,289,265,
%U 267,487,275,392,278,754,692,492,257,857,572,524,674,428,1133,748,1322,867
%N 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 a(2065) > 100000. - _Hans Havermann_, Aug 10 2018
%D Sequence Fans Mailing list.
%H 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 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 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 (Python)
%o from num2words import num2words as n2w
%o from collections import Counter
%o from itertools import count, islice
%o def key(n):
%o return Counter(c for c in n2w(n).replace(" and", "") if c.isalpha())
%o def included(c1, c2): # in Python 3.10+, use c[i] <= c[k] in agen()
%o return all(c1[c] <= c2[c] for c in c1)
%o def agen():
%o n, adict, c = 1, {0: 1}, [None]
%o for k in count(1):
%o c.append(key(k))
%o v = sum(1 for i in range(1, k) if included(c[i], c[k]))
%o if v not in adict: adict[v] = k
%o while n in adict: yield adict[n]; n += 1
%o if k%10000 == 0:
%o print("...", k)
%o print(list(islice(agen(), 54))) # _Michael S. Branicky_, Aug 19 2022
%Y Cf. A317423 (Spanish).
%K nonn,word
%O 1,1
%A _Claudio Meller_, Jul 27 2018
|