OFFSET
0,4
COMMENTS
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (0,1,0,1,0,-1).
FORMULA
a(n+3) = (A185048(n+3)=2,2,4,2,... ) + 1.
a(n+2) - a(n) = 0, 2, 2, 2. (Period 4).
a(n) = 2*a(n-4) - a(n-8).
a(2*n) = A109613(n).
a(n+1) - a(n) = 2* (-1)^n * A059169(n).
G.f. : ( 1+x+2*x^3+x^4+x^5 ) / ( (x^2+1)*(x-1)^2*(1+x)^2 ). - Jean-François Alcover, Aug 14 2012
MATHEMATICA
a[n_?EvenQ] := n/2 + Boole[Mod[n, 4] == 0]; a[n_?OddQ] := n; Table[a[n], {n, 0, 86}] (* Jean-François Alcover, Aug 14 2012 *)
LinearRecurrence[{0, 1, 0, 1, 0, -1}, {1, 1, 1, 3, 3, 5}, 50] (* G. C. Greubel, Apr 23 2018 *)
PROG
(PARI) x='x+O('x^30); Vec(( 1+x+2*x^3+x^4+x^5 )/( (x^2+1)*(x-1)^2*(1+x)^2 )) \\ G. C. Greubel, Apr 23 2018
(Magma) I:=[1, 1, 1, 3, 3, 5]; [n le 6 select I[n] else Self(n-2) +Self(n-4) -Self(n-6): n in [1..30]]; // G. C. Greubel, Apr 23 2018
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Aug 13 2012
STATUS
approved