# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a159451 Showing 1-1 of 1 %I A159451 #11 Feb 13 2024 08:13:48 %S A159451 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, %T A159451 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, %U A159451 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 %N A159451 Number of numbers less than n, that are contained in n written as English number names. %C A159451 a(A159452(n)) = 0; %C A159451 a(A159453(n)) = n and a(m) <> n for m < A159453(n). %H A159451 Reinhard Zumkeller, Table of n, a(n) for n = 0..10000 %H A159451 Robert G. Wilson v, English names for the numbers from 0 to 11159 without spaces or hyphens %e A159451 n = 19 -> nineteen: a(19) = #{nine} = 1; %e A159451 n = 20 -> twenty: a(20) = #{} = 0; %e A159451 n = 21 -> twentyone: a(21) = #{one, twenty} = 2. %o A159451 (Python) %o A159451 from num2words import num2words %o A159451 from functools import cache %o A159451 @cache %o A159451 def n2w(n): %o A159451 map = {ord(c): None for c in "-, "} %o A159451 return num2words(n).replace(" and", "").translate(map) %o A159451 def a(n): wn = n2w(n); return sum(1 for i in range(n) if n2w(i) in wn) %o A159451 print([a(n) for n in range(105)]) # _Michael S. Branicky_, Feb 13 2024 %Y A159451 Cf. A000027, A159452, A159453. %K A159451 nonn,word %O A159451 0,22 %A A159451 _Reinhard Zumkeller_, Apr 12 2009 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE