OFFSET
0,4
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
FORMULA
a(n) = a(n-1) + a(n-4) - a(n-5).
G.f.: x^2*(1+x-x^2)/((1-x)^2*(1+x)*(1+x^2)).
a(n) = (3 - (-1)^n - (1+3*i)*(-i)^n - (1-i*3)*i^n + 2*n)/8 where i=sqrt(-1). - Colin Barker, Oct 16 2015
a(n) = (2*n+3-2*cos(n*Pi/2)-cos(n*Pi)-6*sin(n*Pi/2))/8. - Wesley Ivan Hurt, Oct 01 2017
a(n) = n - 2*floor(n/4) - floor((n+3)/4). - Ridouane Oudra, Dec 11 2023
MAPLE
seq(n-2*floor(n/4)-floor((n+3)/4), n=0..100) ; # Ridouane Oudra, Dec 11 2023
MATHEMATICA
CoefficientList[Series[x^2 (1 + x - x^2)/((1 - x)^2 (1 + x) (1 + x^2)), {x, 0, 100}], x] (* Vincenzo Librandi, Sep 06 2014 *)
LinearRecurrence[{1, 0, 0, 1, -1}, {0, 0, 1, 2, 1}, 100] (* Harvey P. Dale, Jun 13 2016 *)
PROG
(PARI) N=166; x='x+O('x^N);
v=Vec(serlaplace(exp(x+x^2/2)));
vector(#v, n, valuation(v[n], 2))
(PARI) concat([0, 0], Vec(x^2*(1+x-x^2)/((1-x)^2*(1+x)*(1+x^2))+O(x^166)))
(Magma) I:=[0, 0, 1, 2, 1]; [n le 5 select I[n] else Self(n-1)+Self(n-4)-Self(n-5): n in [1..100]]; // Vincenzo Librandi, Sep 06 2014
(PARI) a(n) = (3 - (-1)^n - (1+3*I)*(-I)^n - (1-I*3)*I^n + 2*n)/8 \\ Colin Barker, Oct 16 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Joerg Arndt, Sep 06 2014
STATUS
approved