OFFSET
0,1
COMMENTS
a(n) = 2 for n = 0,1,2 modulo 6; a(n) = 1 for n = 3,4,5 modulo 6.
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,0,-1,1).
FORMULA
G.f.: (1+2*x^3)/((1-x)*(1+x)*(1-x+x^2)); a(n) = 3/2-(-1)^n/6-A057079(n)/3. [R. J. Mathar, Sep 17 2008]
a(n) = a(n-1) - a(n-3) + a(n-4) for n>3; a(n) = 1 + mod(floor((-n-1)/3), 2); a(n) = A088911(n) + 1. - Wesley Ivan Hurt, Sep 04 2014
a(n) = (9 + cos(n*Pi) + 2*cos(n*Pi/3) + 2*sqrt(3)*sin(n*Pi/3))/6. - Wesley Ivan Hurt, Jun 23 2016
MAPLE
MATHEMATICA
Table[1 + Mod[Floor[(-n - 1)/3], 2], {n, 0, 100}] (* Wesley Ivan Hurt, Sep 04 2014 *)
PROG
(Magma) [1+(Floor((-n-1)/3) mod 2) : n in [0..100]]; // Wesley Ivan Hurt, Sep 04 2014
(PARI) a(n)=[2, 2, 2, 1, 1, 1][n%6+1] \\ Edward Jiang, Sep 04 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Philippe Deléham, Sep 11 2008, Sep 15 2008
STATUS
approved