A077954 Expansion of 1/(1-x+2*x^2-x^3) in powers of x.
1, 1, -1, -2, 1, 4, 0, -7, -3, 11, 10, -15, -24, 16, 49, -7, -89, -26, 145, 108, -208, -279, 245, 595, -174, -1119, -176, 1888, 1121, -2831, -3185, 3598, 7137, -3244, -13920, -295, 24301, 10971, -37926, -35567, 51256, 84464, -53615, -171287, 20407, 309366, 97265, -501060, -386224, 713161
Offset: 0
Examples
G.f. = 1 + x - x^2 - 2*x^3 + x^4 + 4*x^5 - 7*x^7 - 3*x^8 + 11*x^9 + ...
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Paul Barry, Centered polygon numbers, heptagons and nonagons, and the Robbins numbers, arXiv:2104.01644 [math.CO], 2021.
- Index entries for linear recurrences with constant coefficients, signature (1,-2,1).
Programs
-
GAP
a:=[1,1,-1];; for n in [4..50] do a[n]:=a[n-1]-2*a[n-2]+a[n-3]; od; a; # G. C. Greubel, Aug 07 2019
-
Magma
R
:=PowerSeriesRing(Integers(), 50); Coefficients(R!( 1/(1-x+2*x^2-x^3) )); // G. C. Greubel, Aug 07 2019 -
Maple
seq(coeff(series(1/(1-x+2*x^2-x^3), x, n+1), x, n), n = 0..50); # G. C. Greubel, Aug 07 2019
-
Mathematica
a[ n_] := If[ n < 0, SeriesCoefficient[ x^3 / (1 - 2 x + x^2 - x^3), {x, 0, -n}], SeriesCoefficient[ 1 / (1 - x + 2 x^2 - x^3), {x, 0, n}]] LinearRecurrence[{1,-2,1}, {1,1,-1}, 50] (* G. C. Greubel, Aug 07 2019 *)
-
PARI
{a(n) = if( n<0, polcoeff( x^3 / (1 - 2*x + x^2 - x^3) + x * O(x^-n), -n), polcoeff( 1 / (1 - x + 2*x^2 - x^3) + x * O(x^n), n))} /* Michael Somos, Sep 18 2012 */
-
Sage
(1/(1-x+2*x^2-x^3)).series(x, 50).coefficients(x, sparse=False) # G. C. Greubel, Aug 07 2019
Formula
a(0)=1, a(1)=1, a(2)=-1, a(n) = a(n-1) -2*a(n-2) +a(n-3) for n>=3. - Philippe Deléham, Sep 15 2006
a(n) = A000931(-2*n). - Michael Somos, Sep 18 2012
a(n) = A005314(-n-2). - Michael Somos, Dec 13 2013
a(n) = a(n-1) - 2*a(n-2) + a(n-3) for all n in Z. - Michael Somos, Dec 13 2013