A030139 a(n+1) = sum of digits of (a(n) + a(n-1)).
1, 4, 5, 9, 5, 5, 1, 6, 7, 4, 2, 6, 8, 5, 4, 9, 4, 4, 8, 3, 2, 5, 7, 3, 1, 4, 5, 9, 5, 5, 1, 6, 7, 4, 2, 6, 8, 5, 4, 9, 4, 4, 8, 3, 2, 5, 7, 3, 1, 4, 5, 9, 5, 5, 1, 6, 7, 4, 2, 6, 8, 5, 4, 9, 4, 4, 8, 3, 2, 5, 7, 3, 1, 4, 5, 9, 5, 5, 1, 6, 7, 4, 2, 6, 8, 5, 4, 9, 4, 4, 8, 3, 2, 5, 7, 3, 1, 4, 5
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1).
Programs
-
Maple
A[0]:= 1: A[1]:= 4: for i from 2 to 100 do t:= A[i-2]+A[i-1]; A[i]:=(t + 9*(t mod 10))/10; od: seq(A[i],i=0..100); # Robert Israel, Apr 28 2016
-
Mathematica
a[0] = 1; a[1] = 4; a[n_] := a[n] = Total@ IntegerDigits[a[n - 1] + a[n - 2]]; Table[a@ n, {n, 0, 120}] (* Michael De Vlieger, Apr 28 2016 *) nxt[{a_,b_}]:={b,Total[IntegerDigits[a+b]]}; NestList[nxt,{1,4},100][[All,1]] (* or *) PadRight[{},100,{1,4,5,9,5,5,1,6,7,4,2,6,8,5,4,9,4,4,8,3,2,5,7,3}] (* Harvey P. Dale, Apr 27 2018 *)
-
PARI
a(n)=n=n%24;my(a=3,b=1);while(n,[a,b]=[b,sumdigits(a+b)]; n--);b \\ Charles R Greathouse IV, Apr 28 2016
Formula
G.f.: (1+4*x+5*x^2+9*x^3+5*x^4+5*x^5+x^6+6*x^7+7*x^8+4*x^9+2*x^10+6*x^11+8*x^12+5*x^13+4*x^14+9*x^15+4*x^16+4*x^17+8*x^18+3*x^19+2*x^20+5*x^21+7*x^22+3*x^23)/(1-x^24). - Robert Israel, Apr 28 2016
Comments