OFFSET
0,5
LINKS
Index entries for linear recurrences with constant coefficients, signature (1,-1,1,-1,1).
FORMULA
G.f.: (2*x^2+1)*x^2/((1-x)*(x^2+x+1)*(x^2-x+1)). - R. J. Mathar, Nov 14 2007
a(n) = floor((n mod 6)/2). - Gary Detlefs, Jul 02 2011
a(n) = a(n-1) - a(n-2) + a(n-3) - a(n-4) + a(n-5) for n > 4; a(0)=0, a(1)=0, a(2)=1, a(3)=1, a(4)=2. - Harvey P. Dale, Mar 30 2012
a(n) = (3*sin(n*Pi/6) - sqrt(3)*cos(n*Pi/6)) * (2*sin(n*Pi/6) + sin(n*Pi/2))/3. - Wesley Ivan Hurt, Jun 20 2016
a(n) = floor(n/2) mod 3. - Bruno Berselli, Oct 03 2017
a(n) = floor(n/2) - 3*floor(n/6). - Ridouane Oudra, Apr 01 2023
MAPLE
A131555:=n->[0, 0, 1, 1, 2, 2][(n mod 6)+1]: seq(A131555(n), n=0..100); # Wesley Ivan Hurt, Jun 20 2016
MATHEMATICA
PadRight[{}, 120, {0, 0, 1, 1, 2, 2}] (* or *) LinearRecurrence[{1, -1, 1, -1, 1}, {0, 0, 1, 1, 2}, 120] (* Harvey P. Dale, Mar 30 2012 *)
PROG
(PARI) a(n)=n%6\2 \\ Jaume Oliver Lafont, Aug 28 2009
(Magma) &cat [[0, 0, 1, 1, 2, 2]^^20]; // Wesley Ivan Hurt, Jun 20 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul Curtz, Aug 27 2007
EXTENSIONS
Edited by N. J. A. Sloane, Sep 15 2007
Formula simplified by Bruno Berselli, Sep 27 2010
STATUS
approved