A192906 Constant term in the reduction by (x^2 -> x + 1) of the polynomial p(n,x) defined below at Comments.
1, 1, 2, 7, 23, 72, 225, 705, 2210, 6927, 21711, 68048, 213281, 668481, 2095202, 6566935, 20582567, 64511384, 202196289, 633738369, 1986309058, 6225634847, 19512839199, 61158565024
Offset: 0
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- Index entries for linear recurrences with constant coefficients, signature (3,0,1,1).
Programs
-
GAP
a:=[1,1,2,7];; for n in [5..30] do a[n]:=3*a[n-1]+a[n-3]+a[n-4]; od; a; # G. C. Greubel, Jan 11 2019
-
Magma
m:=30; R
:=PowerSeriesRing(Integers(), m); Coefficients(R!( (1-2*x-x^2)/(1-3*x-x^3-x^4) )); // G. C. Greubel, Jan 11 2019 -
Mathematica
(* To obtain very general results, delete the next line. *) u = 1; v = 1; a = 1; b = 1; c = 1; d = 1; e = 1; f = 0; q = x^2; s = u*x + v; z = 24; p[0, x_] := a; p[1, x_] := b*x + c; p[n_, x_] := d*(x^2)*p[n - 1, x] + e*x*p[n - 2, x] + f; Table[Expand[p[n, x]], {n, 0, 8}] (* p(0,x), p(1,x), ... p(5,x) *) reduce[{p1_, q_, s_, x_}]:= FixedPoint[(s PolynomialQuotient @@ #1 + PolynomialRemainder @@ #1 &)[{#1, q, x}] &, p1] t = Table[reduce[{p[n, x], q, s, x}], {n, 0, z}]; u0 = Table[Coefficient[Part[t, n], x, 0], {n, 1, z}] (* A192904 *) u1 = Table[Coefficient[Part[t, n], x, 1], {n, 1, z}] (* A192905 *) Simplify[FindLinearRecurrence[u0]] (* recurrence for 0-sequence *) Simplify[FindLinearRecurrence[u1]] (* recurrence for 1-sequence *) LinearRecurrence[{3,0,1,1}, {1,1,2,7}, 30] (* G. C. Greubel, Jan 11 2019 *)
-
PARI
my(x='x+O('x^30)); Vec((1-2*x-x^2)/(1-3*x-x^3-x^4)) \\ G. C. Greubel, Jan 11 2019
-
Sage
((1-2*x-x^2)/(1-3*x-x^3-x^4)).series(x, 30).coefficients(x, sparse=False) # G. C. Greubel, Jan 11 2019
Formula
a(n) = 3*a(n-1) + a(n-3) + a(n-4).
G.f.: (1-2*x-x^2)/(1-3*x-x^3-x^4). - Colin Barker, Aug 31 2012
Comments