A131026 Periodic sequence (2, 2, 1, 0, 0, 1).
2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1
Offset: 1
Links
- Index entries for linear recurrences with constant coefficients, signature (2, -2, 1).
Crossrefs
Programs
-
Magma
m:=105; [ [2, 2, 1, 0, 0, 1][(n-1) mod 6 + 1]: n in [1..m] ];
-
Mathematica
PadRight[{},120,{2,2,1,0,0,1}] (* or *) LinearRecurrence[{2,-2,1},{2,2,1},120] (* Harvey P. Dale, Jul 16 2012 *)
-
PARI
{m=105; for(n=1, m, r=(n-1)%6; print1(if(r<2, 2, if(r==2||r==5, 1, 0)), ","))}
Formula
a(1) = a(2) = 2, a(3) = 1, a(4) = a(5) = 0, a(6) = 1; for n > 6, a(n) = a(n-6).
G.f.: (2-2*x+x^2)/((1-x)*(1-x+x^2)).
a(n) = A021823(n+2).
a(n) = floor(((n+3) mod 6)/4)+floor(((n+2) mod 3)/2). - Gary Detlefs, Oct 02 2013
a(n) = 1+2/sqrt(3)*sin(Pi/3*n). - Werner Schulte, Jul 21 2017
Comments