login
a(n) = (sum of digits of a(n-2)) + a(n-1); a(0) = 0 and a(1) = 1.
2

%I #10 Aug 12 2017 03:03:03

%S 0,1,1,2,3,5,8,13,21,25,28,35,45,53,62,70,78,85,100,113,114,119,125,

%T 136,144,154,163,173,183,194,206,220,228,232,244,251,261,269,278,295,

%U 312,328,334,347,357,371,386,397,414,433,442,452,462,473,485,499,516

%N a(n) = (sum of digits of a(n-2)) + a(n-1); a(0) = 0 and a(1) = 1.

%H Harry J. Smith, <a href="/A065124/b065124.txt">Table of n, a(n) for n = 0..1000</a>

%p a[0]:=0:a[1]:=1:a[2]:=1:for n from 3 to 100 do d:=a[n-1]:s:=0:while d>0 do c:=d mod 10:s:=s+c:d:=(d-c)/10 od:e:=a[n-2]:t:=0:while e>0 do c:=e mod 10:t:=t+c:e:=(e-c)/10 od:a[n]:=a[n-1]+t od: seq(a[n], n=0..56); # _Zerinvary Lajos_, Mar 19 2009

%t a[0] = 0; a[1] = 1; a[n_] := a[n] = Apply[ Plus, IntegerDigits[ a[n - 2] ]] + a[n - 1]; Table[ a[n], {n, 0, 100} ]

%o (PARI) SumD(x)= { local(s=0); while (x>9, s+=x-10*(x\10); x\=10); return(s + x) } { for (n=0, 1000, if (n>1, a=SumD(a2) + a1; a2=a1; a1=a, if (n, a=a1=1, a=a2=0)); write("b065124.txt", n, " ", a) ) } \\ _Harry J. Smith_, Oct 10 2009

%Y Cf. A007612, A007953, A065076.

%K base,easy,nonn

%O 0,4

%A _Robert G. Wilson v_, Nov 13 2001