OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (2,-2,2,-1).
FORMULA
From Bruno Berselli, Dec 05 2011: (Start)
G.f.: x^2*(2-x+3*x^2)/((1-x)^2*(1+x^2)).
a(n) = 2*(n-1)-(i^(n*(n+1))+1)/2, where i=sqrt(-1). (End)
From Wesley Ivan Hurt, Jun 04 2016: (Start)
a(n) = 2*a(n-1) - 2*a(n-2) + 2*a(n-3) - a(n-4) for n>4.
E.g.f.: (6 + sin(x) - cos(x) + (4*x - 5)*exp(x))/2. - Ilya Gutkovskiy, Jun 05 2016
Sum_{n>=2} (-1)^n/a(n) = (3-2*sqrt(2))*Pi/16 + 3*log(2)/8. - Amiram Eldar, Dec 21 2021
MAPLE
MATHEMATICA
Table[(1+I)*((4-4*I)*n+5*I-5+I^(1-n)-I^n)/4, {n, 80}] (* Wesley Ivan Hurt, Jun 04 2016 *)
Flatten[#+{0, 2, 3, 5}&/@(8*Range[0, 20])] (* or *) LinearRecurrence[{2, -2, 2, -1}, {0, 2, 3, 5}, 100] (* Harvey P. Dale, Sep 30 2018 *)
PROG
(PARI) a(n)=n\4*8+[-3, 0, 2, 3][n%4+1] \\ Charles R Greathouse IV, Dec 05 2011
(Magma) [n : n in [0..150] | n mod 8 in [0, 2, 3, 5]]; // Wesley Ivan Hurt, Jun 04 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved