OFFSET
0,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..2000
Index entries for linear recurrences with constant coefficients, signature (1,0,1,-1).
FORMULA
G.f.: x*(2-x+x^2)/((x-1)^2*(1+x+x^2)); a(n) = a(n-1)+a(n-3)-a(n-4); a(n) = (-n mod 3) + 2*floor(n/3) = A080425(n) + 2*A002264(n). - Wesley Ivan Hurt, Aug 20 2014
E.g.f.: ((2*z+1)/3)*exp(z)+((5/9)*sqrt(3)*sin(sqrt(3)*z/2)-(1/3)*cos(sqrt(3)*z/2))*exp(-z/2). - Robert Israel, Aug 21 2014
a(n) = (6*n+3-6*cos(2*(n+4)*Pi/3)-4*sqrt(3)*sin(2*(n+4)*Pi/3))/9. - Wesley Ivan Hurt, Sep 26 2017
MAPLE
MATHEMATICA
Table[Mod[-n, 3] + 2 Floor[n/3], {n, 0, 100}] (* Wesley Ivan Hurt, Aug 20 2014 *)
CoefficientList[Series[x*(2 - x + x^2)/((x - 1)^2 (1 + x + x^2)), {x, 0, 100}], x] (* Wesley Ivan Hurt, Aug 20 2014 *)
LinearRecurrence[{1, 0, 1, -1}, {0, 2, 1, 2}, 200] (* Vincenzo Librandi, Sep 27 2017 *)
PROG
(Magma) [(-n mod 3) + 2*Floor(n/3) : n in [0..100]]; // Wesley Ivan Hurt, Aug 20 2014
(Magma) I:=[0, 2, 1, 2]; [n le 4 select I[n] else Self(n-1)+Self(n-3)-Self(n-4): n in [1..100]]; // Vincenzo Librandi, Sep 27 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Oct 01 2007
STATUS
approved