login
Expansion of (1-x)/(1-x+2*x^2+2*x^3).
1

%I #10 Sep 08 2022 08:45:08

%S 1,0,-2,-4,0,12,20,-4,-68,-100,44,380,492,-356,-2100,-2372,2540,11484,

%T 11148,-16900,-62164,-50660,107468,333116,219500,-661668,-1766900,

%U -882564,3974572,9273500,3089484,-23406660,-48132628,-7498276,135580300,246842108,-9321940,-774166756

%N Expansion of (1-x)/(1-x+2*x^2+2*x^3).

%H G. C. Greubel, <a href="/A078022/b078022.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (1,-2,-2).

%F a(n) = A077956(n) - A077956(n-1) = (-1)^(n-1)*(A077977(n) + A077977(n-1)). - _G. C. Greubel_, Jun 29 2019

%e G.f. = 1 - 2*x^2 - 4*X^3 + 12*X^5 + 20*X^6 - 4*X^7 - 68*X^8 - 100*X^9 + ... - _Michael Somos_, Jun 29 2019

%t CoefficientList[Series[(1-x)/(1-x+2*x^2+2*x^3),{x,0,40}],x] (* or *) LinearRecurrence[{1,-2,-2},{1,0,-2},40] (* _Harvey P. Dale_, Mar 25 2018 *)

%t a[ n_] := LinearRecurrence[{1, -2, -2}, {1, 0, -2}, {n}][[1]]; (* _Michael Somos_, Jun 29 2019 *)

%o (PARI) my(x='x+O('x^40)); Vec((1-x)/(1-x+2*x^2+2*x^3)) \\ _G. C. Greubel_, Jun 29 2019

%o (Magma) R<x>:=PowerSeriesRing(Integers(), 40); Coefficients(R!( (1-x)/(1-x+2*x^2+2*x^3) )); // _G. C. Greubel_, Jun 29 2019

%o (Sage) ((1-x)/(1-x+2*x^2+2*x^3)).series(x, 40).coefficients(x, sparse=False) # _G. C. Greubel_, Jun 29 2019

%o (GAP) a:=[1,0,-2];; for n in [4..40] do a[n]:=a[n-1]-2*a[n-2]-2*a[n-3]; od; a; # _G. C. Greubel_, Jun 29 2019

%Y Cf. A077956, A077977.

%K sign

%O 0,3

%A _N. J. A. Sloane_, Nov 17 2002