OFFSET
0,3
LINKS
R. Zumkeller, Table of n, a(n) for n = 0..10000
EXAMPLE
a(49) = a(4+9) + (4+9) = a(13) + 13 = a(1+3) + (1+3) + 13 = a(4) + 4 + 13 = 4 + 4 + 13 = 21.
MAPLE
ds := proc(n) local t1, t2; t1 := n; t2 := 0; while t1 <> 0 do t2 := t2 + (t1 mod 10); t1 := floor(t1/10); od: t2; end;
M:=10000; a:=array(0..M); for n from 0 to 9 do a[n]:=n; lprint(n, a[n]); od: for n from 10 to M do a[n]:=a[ds(n)]+ds(n); lprint(n, a[n]); od:
MATHEMATICA
lim=75; Do[a[n]=n, {n, 0, 9}]; Do[a[n]=a[Total[IntegerDigits[n]]]+Total[IntegerDigits[n]], {n, 10, lim}]; Table[a[n], {n, 0, lim}] (* James C. McMahon, Oct 27 2024 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Sep 15 2006
STATUS
approved