OFFSET
0,1
COMMENTS
The polynomial p(n,x) is defined by p(0,x) = 1, p(1,x) = x + 1, and p(n,x) = x*p(n-1,x) + 2*(x^2)*p(n-1,x) + 1. See A192872.
For n>0, also the coefficient of x in the reduction x^2 -> x + 1 of the polynomial A000285(n-1)*x^(n-1). - R. J. Mathar, Jul 12 2011
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,2,-1).
FORMULA
a(n) = 2*a(n-1) + 2*a(n-2) - a(n-3).
G.f.: ( 3 - 2*x^2 - 6*x ) / ( (1+x)*(1 - 3*x + x^2) ). - R. J. Mathar, May 07 2014
a(n) = (2^(-n)*(7*(-2)^n - (-4+sqrt(5))*(3+sqrt(5))^n + (3-sqrt(5))^n*(4+sqrt(5))))/5. - Colin Barker, Sep 29 2016
EXAMPLE
MATHEMATICA
q = x^2; s = x + 1; z = 25;
p[0, x_] := 3; p[1, x_] := x;
p[n_, x_] := p[n - 1, x]*x + p[n - 2, x]*x^2;
Table[Expand[p[n, x]], {n, 0, 7}]
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}];
u1 = Table[Coefficient[Part[t, n], x, 0], {n, 1, z}] (* A192878 *)
u2 = Table[Coefficient[Part[t, n], x, 1], {n, 1, z}] (* A192879 *)
FindLinearRecurrence[u1]
FindLinearRecurrence[u2]
LinearRecurrence[{2, 2, -1}, {3, 0, 4}, 30] (* G. C. Greubel, Jan 08 2019 *)
PROG
(PARI) a(n) = round((2^(-n)*(7*(-2)^n-(-4+sqrt(5))*(3+sqrt(5))^n+(3-sqrt(5))^n*(4+sqrt(5))))/5) \\ Colin Barker, Sep 29 2016
(PARI) Vec((3-2*x^2-6*x)/((1+x)*(x^2-3*x+1)) + O(x^40)) \\ Colin Barker, Sep 29 2016
(Magma) m:=30; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!( (3-2*x^2-6*x)/((1+x)*(x^2-3*x+1)) )); // G. C. Greubel, Jan 08 2019
(Sage) ((3-2*x^2-6*x)/((1+x)*(x^2-3*x+1))).series(x, 30).coefficients(x, sparse=False) # G. C. Greubel, Jan 08 2019
(GAP) a:=[3, 0, 4];; for n in [4..30] do a[n]:=2*a[n-1]+2*a[n-2]-a[n-3]; od; a; # G. C. Greubel, Jan 08 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Jul 11 2011
STATUS
approved