A131555 Period 6: repeat [0, 0, 1, 1, 2, 2].
0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0, 0, 1
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (1,-1,1,-1,1).
Crossrefs
Cf. A105899.
Programs
-
Magma
&cat [[0, 0, 1, 1, 2, 2]^^20]; // Wesley Ivan Hurt, Jun 20 2016
-
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 *)
-
PARI
a(n)=n%6\2 \\ Jaume Oliver Lafont, Aug 28 2009
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
Extensions
Edited by N. J. A. Sloane, Sep 15 2007
Formula simplified by Bruno Berselli, Sep 27 2010