OFFSET
1,1
COMMENTS
Second column of triangular array T defined in A131022.
LINKS
Index entries for linear recurrences with constant coefficients, signature (2, -2, 1).
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
MATHEMATICA
PadRight[{}, 120, {2, 2, 1, 0, 0, 1}] (* or *) LinearRecurrence[{2, -2, 1}, {2, 2, 1}, 120] (* Harvey P. Dale, Jul 16 2012 *)
PROG
(PARI) {m=105; for(n=1, m, r=(n-1)%6; print1(if(r<2, 2, if(r==2||r==5, 1, 0)), ", "))}
(Magma) m:=105; [ [2, 2, 1, 0, 0, 1][(n-1) mod 6 + 1]: n in [1..m] ];
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Klaus Brockhaus, following a suggestion of Paul Curtz, Jun 10 2007
STATUS
approved