|
|
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.
|
|
2
|
|
|
15, 13, 14, 21, 24, 72, 76, 74, 113, 115, 121, 171, 122, 150, 131, 142, 127, 147, 124, 129, 159, 138, 135, 153, 137, 156, 126, 125, 128, 165, 168, 157, 158, 467, 289, 265, 267, 487, 275, 392, 278, 754, 692, 492, 257, 857, 572, 524, 674, 428, 1133, 748, 1322, 867
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
|
|
REFERENCES
|
Sequence Fans Mailing list.
|
|
LINKS
|
|
|
EXAMPLE
|
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'.)
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.
|
|
PROG
|
(Python)
from num2words import num2words as n2w
from collections import Counter
from itertools import count, islice
def key(n):
return Counter(c for c in n2w(n).replace(" and", "") if c.isalpha())
def included(c1, c2): # in Python 3.10+, use c[i] <= c[k] in agen()
return all(c1[c] <= c2[c] for c in c1)
def agen():
n, adict, c = 1, {0: 1}, [None]
for k in count(1):
c.append(key(k))
v = sum(1 for i in range(1, k) if included(c[i], c[k]))
if v not in adict: adict[v] = k
while n in adict: yield adict[n]; n += 1
if k%10000 == 0:
print("...", k)
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,word
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|