A130772 Periodic sequence with period 2 2 0 -2 -2 0.
2, 2, 0, -2, -2, 0, 2, 2, 0, -2, -2, 0, 2, 2, 0, -2, -2, 0, 2, 2, 0, -2, -2, 0, 2, 2, 0, -2, -2, 0, 2, 2, 0, -2, -2, 0, 2, 2, 0, -2, -2, 0, 2, 2, 0, -2, -2, 0, 2, 2
Offset: 0
Examples
G.f. = 2 + 2*x - 2*x^3 - 2*x^4 + 2*x^6 + 2*x^7 - 2*x^9 - 2*x^10 + ...
Links
- G. C. Greubel, Table of n, a(n) for n = 0..2500
- Index entries for linear recurrences with constant coefficients, signature (1,-1).
Programs
-
Magma
I:=[2,2]; [n le 2 select I[n] else Self(n-1) - Self(n-2): n in [1..30]]; // G. C. Greubel, Aug 04 2018
-
Mathematica
PadRight[{},120,{2,2,0,-2,-2,0}] (* or *) LinearRecurrence[{1,-1},{2,2},120] (* Harvey P. Dale, Jan 13 2014 *)
-
PARI
for(i=1,9,print1("2, 2, 0, -2, -2, 0, ")) \\ Charles R Greathouse IV, Jun 02 2011
Formula
O.g.f.: 2/(x^2-x+1). a(n) = 2*A010892(n) . - R. J. Mathar, Feb 14 2008
a(0)=2, a(1)=2, a(n)=a(n-1)-a(n-2). - Harvey P. Dale, Jan 13 2014
Comments