A079757 Periodic sequence 1, 0, -2, 3, -2, 0, ...
1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0, 1, 0, -2, 3, -2, 0
Offset: 0
Links
- G. C. Greubel, Table of n, a(n) for n = 0..10000
- Index entries for linear recurrences with constant coefficients, signature (-2,-2,-1).
Crossrefs
Cf. A057079.
Programs
-
Magma
&cat[[1,0,-2,3,-2,0]: n in [0..20]]; // G. C. Greubel, Mar 27 2024
-
Mathematica
PadRight[{}, 120, {1,0,-2,3,-2,0}] (* G. C. Greubel, Mar 27 2024 *)
-
SageMath
def A079757(n): return [1,0,-2,3,-2,0][n%6] [A079757(n) for n in range(121)] # G. C. Greubel, Mar 27 2024
Formula
a(n) = A057079(2*n+1) - (-1)^floor((2*n+1)/2).
G.f.: (1+2*x)/(1+2*x+2*x^2+x^3).
a(n) = -2*a(n-1) - 2*a(n-2) - a(n-3).
a(n) = |Real(2*(sqrt(3/4)*i - 1/2)^n - (-1)^n )|, where i = sqrt(-1). - Ralf Stephan, Mar 07 2003