A132954 Period 6: repeat [1, 2, 4, -1, -2, -4].
1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2, 4, -1, -2, -4, 1, 2
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (0,0,-1).
Programs
-
Magma
&cat [[1, 2, 4, -1, -2, -4]^^20]; // Wesley Ivan Hurt, Jun 20 2016
-
Maple
A132954:=n->[1, 2, 4, -1, -2, -4][(n mod 6)+1]: seq(A132954(n), n=0..100); # Wesley Ivan Hurt, Jun 20 2016
-
Mathematica
PadRight[{}, 100, {1, 2, 4, -1, -2, -4}] (* Wesley Ivan Hurt, Jun 20 2016 *)
-
PARI
a(n)=(2^n%7)*(-1)^(n%6>2) \\ Jaume Oliver Lafont, Mar 24 2009
Formula
a(n) = -a(n-3) for n>2. G.f.: (1+2*x+4*x^2)/((1+x)*(x^2-x+1)). [R. J. Mathar, Apr 13 2010]
a(n) = cos(n*Pi) + 2*sqrt(3)*sin(n*Pi/3). - Wesley Ivan Hurt, Jun 20 2016
Comments