login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A267809
a(1)=a(2)=1; if n>2 then a(n) = a(n-2) + (a(n-1) mod 10).
5
1, 1, 2, 3, 5, 8, 13, 11, 14, 15, 19, 24, 23, 27, 30, 27, 37, 34, 41, 35, 46, 41, 47, 48, 55, 53, 58, 61, 59, 70, 59, 79, 68, 87, 75, 92, 77, 99, 86, 105, 91, 106, 97, 113, 100, 113, 103, 116, 109, 125, 114, 129, 123, 132, 125, 137, 132, 139, 141, 140, 141, 141, 142, 143, 145, 148, 153
OFFSET
1,3
COMMENTS
a(n) - (7/3)*n is periodic with period 60. - Robert Israel, Jan 20 2016
LINKS
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
STATUS
approved