OFFSET
0,3
LINKS
Seiichi Manyama, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,0,-1,-1,1).
FORMULA
a(n) = 2*a(n-1) - a(n-2) + C(mod(n+2,6) + 1)), C=(10,4,12,2,12,4).
From Colin Barker, May 24 2015: (Start)
a(n) = a(n-1) + a(n-2) - a(n-4) - a(n-5) + a(n-6) for n > 5.
G.f.: x*(4*x^6 - 3*x^4 + 9*x^3 + 16*x^2 + 17*x + 1) / ((1-x)^3*(x + 1)*(x^2 + x + 1)).
(End)
MATHEMATICA
a[0]=0; a[1]=1; a[2]=18; a[3]=35; a[n_]:=a[n]=a[n]=2*a[n-1]-a[n-2]+R[n] c4={10, 4, 12, 2, 12, 4}; R[n_]:=c4[[Mod[n+2, 6]+1]] Table[a[n], {n, 0, 46}]
Join[{0, 1}, LinearRecurrence[{1, 1, 0, -1, -1, 1}, {18, 35, 62, 93, 136, 181}, 50]] (* G. C. Greubel, Apr 30 2018 *)
PROG
(Magma) I:=[18, 35, 62, 93, 136, 181]; [0, 1] cat [n le 6 select I[n] else Self(n-1) +Self(n-2) -Self(n-4) -Self(n-5) +Self(n-6): n in [1..30]]; // G. C. Greubel, Apr 30 2018
(PARI) x='x+O('x^30); concat([0], Vec(x*(4*x^6-3*x^4+9*x^3+16*x^2+ 17*x+1 )/((1-x)^3*(x+1)*(x^2+x+1)))) \\ G. C. Greubel, Apr 30 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Seppo Mustonen, May 28 2009
STATUS
approved