A077990 Expansion of 1/(1 + 2*x + x^2 - x^3).
1, -2, 3, -3, 1, 4, -12, 21, -26, 19, 9, -63, 136, -200, 201, -66, -269, 805, -1407, 1740, -1268, -611, 4230, -9117, 13393, -13439, 4368, 18096, -53999, 94270, -116445, 84621, 41473, -284012, 611172, -896859, 898534, -289037, -1217319, 3622209, -6316136, 7792744, -5647143, -2814594
Offset: 0
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (-2,-1,1).
Crossrefs
Cf. A077941.
Programs
-
GAP
a:=[1,-2,3];; for n in [4..50] do a[n]:=-2*a[n-1]-a[n-2]+a[n-3]; od; a; # G. C. Greubel, Jun 26 2019
-
Magma
R
:=PowerSeriesRing(Integers(), 50); Coefficients(R!( 1/(1+2*x+x^2-x^3) )); // G. C. Greubel, Jun 26 2019 -
Maple
A077990 := proc(n) option remember ; if n <=2 then (-1)^n*(n+1) ; else -2*procname(n-1)-procname(n-2)+procname(n-3) ; end if; end proc: seq(A077990(n),n=0..20) ; # R. J. Mathar, Feb 25 2024
-
Mathematica
CoefficientList[Series[1/(1+2x+x^2-x^3),{x,0,50}],x] (* or *) LinearRecurrence[ {-2,-1,1},{1,-2,3},50] (* Harvey P. Dale, Aug 10 2016 *)
-
PARI
Vec(1/(1+2*x+x^2-x^3)+O(x^50)) \\ Charles R Greathouse IV, Sep 26 2012
-
Sage
(1/(1+2*x+x^2-x^3)).series(x, 50).coefficients(x, sparse=False) # G. C. Greubel, Jun 26 2019
Formula
From Paul Barry, May 10 2005: (Start)
G.f.: 1/((1+x)^2-x^3).
a(n) = Sum_{k=0..n+4} (-1)^(n-k-1)*C(n+3, k)*Sum_{j=0..floor(k/3)} C(k-2j, j). (End)
a(n) = (-1)^n * A077941(n). - G. C. Greubel, Jun 26 2019