login
A159451
Number of numbers less than n, that are contained in n written as English number names.
3
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 3, 3, 3, 3, 2, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 2, 3, 3, 1, 3, 3, 3, 3, 3, 3, 3, 2, 3, 1, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 2, 3, 3, 3
OFFSET
0,22
COMMENTS
a(A159452(n)) = 0;
a(A159453(n)) = n and a(m) <> n for m < A159453(n).
EXAMPLE
n = 19 -> nineteen: a(19) = #{nine} = 1;
n = 20 -> twenty: a(20) = #{} = 0;
n = 21 -> twentyone: a(21) = #{one, twenty} = 2.
PROG
(Python)
from num2words import num2words
from functools import cache
@cache
def n2w(n):
map = {ord(c): None for c in "-, "}
return num2words(n).replace(" and", "").translate(map)
def a(n): wn = n2w(n); return sum(1 for i in range(n) if n2w(i) in wn)
print([a(n) for n in range(105)]) # Michael S. Branicky, Feb 13 2024
CROSSREFS
KEYWORD
nonn,word
AUTHOR
Reinhard Zumkeller, Apr 12 2009
STATUS
approved