OFFSET
1,3
COMMENTS
a(n) - (7/3)*n is periodic with period 60. - Robert Israel, Jan 20 2016
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (0,1,0,0,0,1,0,-1,0,0,0, -1,0,1,1,0,-1,1,0, -1,-1,0,1, -1,0,1,1,0, -1,0,0,0, -1,0,1,0,0,0,1,0,-1).
FORMULA
G.f.: (x + x^2 + x^3 + 2*x^4 + 3*x^5 + 5*x^6 + 7*x^7 + 2*x^8 + 2*x^10 + 2*x^11 + 4*x^12 - 3*x^13 + x^14 + 7*x^15 - 3*x^16 + 4*x^17 + 2*x^18 + 5*x^19 - 3*x^20 - 7*x^21 + x^22 - 6*x^23 + 4*x^24 - x^25 + 3*x^26 + x^27 + 3*x^28 + 4*x^29 - 2*x^30 + 2*x^31 + 2*x^33 + 3*x^34 + 5*x^35 + 7*x^36 + 2*x^37 + 9*x^38 + x^39 - x^40)/(1 - x^2 - x^6 + x^8 + x^12 - x^14 - x^15 + x^17 - x^18 + x^20 + x^21 - x^23 + x^24 - x^26 - x^27 + x^29 + x^33 - x^35 - x^39 + x^41). - Robert Israel, Jan 20 2016
MAPLE
A[1]:=1: A[2]:= 1:
for n from 3 to 100 do A[n]:= A[n-2] + (A[n-1] mod 10) od:
seq(A[n], n=1..100); # Robert Israel, Jan 20 2016
MATHEMATICA
a[1] = a[2] = 1; a[n_] := a[n] = Mod[a[n - 1], 10] + a[n - 2]; Array[a, 100]
nxt[{n_, a_, b_}]:={n+1, b, a+Mod[b, 10]}; NestList[nxt, {2, 1, 1}, 70] [[All, 2]] (* Harvey P. Dale, Nov 13 2021 *)
PROG
(PARI) lista(nn)=print1(a = 1, ", "); print1(b = 1, ", "); for (n=1, nn, c = a + b % 10; print1(c, ", "); a = b; b = c; ); \\ Michel Marcus, Feb 10 2016
(PARI) a=vector(10^5); a[1]=a[2]=1; for(n=3, #a, a[n]=a[n-1]%10+a[n-2]); a \\ Altug Alkan, Mar 20 2018
(Magma) I:=[1, 1, 2]; [n le 3 select I[n] else Self(n-2)+(Self(n-1)mod 10): n in [1..70]]; // Vincenzo Librandi, Feb 12 2016
(GAP) a:=[1, 1];; for n in [3..70] do a[n]:=a[n-2]+(a[n-1] mod 10); od; a; # Muniru A Asiru, Mar 20 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
José María Grau Ribas, Jan 20 2016
STATUS
approved