reviewed
approved
reviewed
approved
proposed
reviewed
editing
proposed
R. Reinhard Zumkeller, <a href="/A159451/b159451.txt">Table of n, a(n) for n = 0..10000</a>
reviewed
editing
proposed
reviewed
editing
proposed
n = 19 -> nineteen: a(19) = #{nine} = 1;
n = 20 -> twenty: a(20) = #{} = 0;
n = 21 -> twentyone: a(21) = #{one, twenty} = 2.
(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
approved
editing
_Reinhard Zumkeller (reinhard.zumkeller(AT)gmail.com), _, Apr 12 2009