A122876 a(0)=1, a(1)=1, a(2)=2, a(n) = a(n-1) - a(n-2) for n>2.
1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1, 1, 2, 1, -1, -2, -1
Offset: 0
Links
- Index entries for linear recurrences with constant coefficients, signature (1,-1).
Programs
-
Mathematica
LinearRecurrence[{1,-1}, {1,1,2}, 50] (* G. C. Greubel, May 03 2017; corrected by Georg Fischer, Apr 02 2019 *) (* or *) CoefficientList[Series[(1 + 2*x^2)/(1 - x + x^2), {x,0,50}], x] (* G. C. Greubel, May 03 2017 *)
-
PARI
my(x='x+O('x^50)); Vec((1+2*x^2)/(1-x+x^2)) \\ G. C. Greubel, May 03 2017
Formula
a(n) = Sum_{k=0..floor(n/2)} (-2)^k*A055830(n-k,k).
G.f.: (1+2*x^2)/(1-x+x^2).
Comments