OFFSET
0,4
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,1,0,1,0,-1).
FORMULA
G.f.: x*(1-x+3x^2+x^3)/((x^2-1)^2*(x^2+1)).
|a(n)| = n-(-1)^n*|a(n-1)|. - Vladeta Jovovic, Mar 13 2003
a(4n)=0, a(4n+1)=4n+1, a(4n+2)=-1, a(4n+3)=4n+4, n>=0.
From Wesley Ivan Hurt, May 01 2016, May 03 2016: (Start)
a(n) = a(n-2)+a(n-4)-a(n-6) for n>5.
a(n) = (-1)^floor((n-1)/2) * Sum_{i=0..n} i*(-1)^floor(i/2).
a(n) = (n-(n+1)*(-1)^n+(-1)^((2*n+1-(-1)^n)/4))/2. (End)
E.g.f.: (cos(x) + (-1 + 2*x)*cosh(x) - sin(x) + sinh(x))/2. - Ilya Gutkovskiy, May 03 2016
MAPLE
A003816:=n->(n-(n+1)*(-1)^n+(-1)^((2*n+1-(-1)^n)/4))/2: seq(A003816(n), n=0..150); # Wesley Ivan Hurt, May 03 2016
MATHEMATICA
CoefficientList[Series[x*(1 - x + 3 x^2 + x^3)/((x^2 - 1)^2*(x^2 + 1)), {x, 0, 100}], x] (* Wesley Ivan Hurt, May 01 2016 *)
nxt[{n_, a_}]:={n+1, BitXor[a, -n-1]}; -#&/@(NestList[nxt, {0, 0}, 70][[All, 2]]) (* or *) LinearRecurrence[{0, 1, 0, 1, 0, -1}, {0, 1, -1, 4, 0, 5}, 70] (* Harvey P. Dale, Oct 16 2019 *)
PROG
(PARI) a(n)=([0, 1, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1; -1, 0, 1, 0, 1, 0]^n*[0; 1; -1; 4; 0; 5])[1, 1] \\ Charles R Greathouse IV, May 02 2016
(Magma) [(n-(n+1)*(-1)^n+(-1)^((2*n+1-(-1)^n) div 4))/2 : n in [0..100]]; // Wesley Ivan Hurt, May 03 2016
CROSSREFS
KEYWORD
sign,easy
AUTHOR
STATUS
approved