Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #16 Sep 08 2022 08:45:28
%S 0,1,3,9,29,90,284,890,2797,8780,27574,86581,271881,853732,2680833,
%T 8418132,26433983,83005929,260648825,818469251,2570093890,8070410030,
%U 25342077544,79577232067,249882270390,784660981474,2463931734897
%N Expansion of x^2*(1+x-x^2)/(1-2*x-4*x^2+x^3+x^4).
%H G. C. Greubel, <a href="/A123947/b123947.txt">Table of n, a(n) for n = 1..1000</a>
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,4,-1,-1).
%p seq(coeff(series(x^2*(1+x-x^2)/(1-2*x-4*x^2+x^3+x^4), x, n+1), x, n), n = 1..30); # _G. C. Greubel_, Aug 05 2019
%t M = {{0,-1,-1,0,1}, {-1,0,0,0,-1}, {-1,0,1,0,-1}, {0,0,-1,0,0}, {1,-1, -1,0,1}}; v[1] = {0,0,0,0,1}; v[n_]:= v[n] = M.v[n-1]; Table[v[n][[1]], {n, 30}]
%t CoefficientList[Series[x^2*(1+x-x^2)/(1-2*x-4*x^2+x^3+x^4), {x, 0, 30}], x] (* _G. C. Greubel_, Aug 05 2019 *)
%o (PARI) my(x='x+O('x^30)); concat([0], Vec(x^2*(1+x-x^2)/(1-2*x-4*x^2+x^3+x^4))) \\ _G. C. Greubel_, Aug 05 2019
%o (Magma) R<x>:=PowerSeriesRing(Integers(), 30); [0] cat Coefficients(R!( x^2*(1+x-x^2)/(1-2*x-4*x^2+x^3+x^4) )); // _G. C. Greubel_, Aug 05 2019
%o (Sage) a=(x^2*(1+x-x^2)/(1-2*x-4*x^2+x^3+x^4)).series(x, 30).coefficients(x, sparse=False); a[1:] # _G. C. Greubel_, Aug 05 2019
%o (GAP) a:=[0,1,3,9];; for n in [5..30] do a[n]:=2*a[n-1]+4*a[n-2]-a[n-3] -a[n-4]; od; a; # _G. C. Greubel_, Aug 05 2019
%Y Cf. A122773, A122771.
%K nonn
%O 1,3
%A _Gary W. Adamson_ and _Roger L. Bagula_, Oct 26 2006