OFFSET
0,1
COMMENTS
Uses the convention of omitting a trailing 'and', so 101 is 'one hundred one' rather than 'one hundred and one.' - Eric W. Weisstein, May 11 2006
From Michael S. Branicky, May 28 2024: (Start)
The only numbers with a(n) = 1 are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12.
The only numbers with a(n) = 2 are 7, 13, 14, 15, 16, 18, 19, 20, 30, 40, 50, 60, 80, 90.
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..10000
Eric Weisstein's World of Mathematics, Number
EXAMPLE
a(76)=4 because seventy-six is split sev.en.ty.six, or four syllables.
PROG
(PARI) A075774(n, t=[10^9, 2, 10^6, 2, 1000, 2, 100, 2])={ n>99 && forstep( i=1, #t, 2, n<t[i] && next; n=divrem(n, t[i]); return( A075774(n[1])+t[i+1]+if( n[2], A075774( n[2] )))); if( n<20, 1+!!setsearch(Set([0, 7, 13, 14, 15, 16, 18, 19]), n) + 2*!!setsearch(Set([11, 17]), n), 2+(n\10==7) + if(n%10, A075774(n%10)))} \\ The "Set()" is not required in PARI v.2.6+ but we put it for downward compatibility. - M. F. Hasler, Nov 03 2013
(Python)
def A075774(n):
t = [(10**i, 2) for i in [12, 9, 6, 3, 2]]
if n > 99:
for ti, sti in t:
if n >= ti:
q, r = divmod(n, ti)
if n < 20:
return 1 + (n in {0, 7, 13, 14, 15, 16, 18, 19}) + 2*(n in {11, 17})
else: return 2 + (n//10==7) + (A075774(n%10) if n%10 else 0)
CROSSREFS
KEYWORD
easy,nonn,word
AUTHOR
Ethan B. Trewhitt, Oct 09 2002
EXTENSIONS
More terms from Eric W. Weisstein, May 11 2006
STATUS
approved