(* First program *)
q = x^2; s = x + 1; z = 26;
p[0, x_] := 1; p[1, x_] := x;
p[n_, x_] := p[n - 1, x]*x + p[n - 2, x]*x^2 + 1;
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}] (*
A192872 *)
u2 = Table[Coefficient[Part[t, n], x, 1], {n, 1, z}] (*
A192873 *)
(* End of 1st program *)
(* ******************************************** *)
(* Alternative: much more general *)
(* u = 1; v = 1; a = 1; b = 1; c = 0; d = 1; e = 1; f = 1; Nine degrees of freedom for user; shown values generate
A192872. *)
q = x^2; s = u*x + v; z = 11;
(* will apply reduction (x^2 -> u*x+v) to p(n, x) *)
p[0, x_] := a; p[1, x_] := b*x + c;
(* initial values of polynomial sequence p(n, x) *)
p[n_, x_] := d*x*p[n - 1, x] + e*(x^2)*p[n - 2, x] + f;
(* recurrence for p(n, x) *)
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}];
u2 = Table[Coefficient[Part[t, n], x, 1], {n, 1, z}];
Simplify[FindLinearRecurrence[u1]] (* for 0-sequence *)
Simplify[FindLinearRecurrence[u2]] (* for 1-sequence *)
u1 = Table[Coefficient[Part[t, n], x, 0], {n, 1, 4}]
(* initial values for 0-sequence *)
u2 = Table[Coefficient[Part[t, n], x, 1], {n, 1, 4}]
(* initial values for 1-sequence *)
LinearRecurrence[{3, 0, -3, 1}, {1, 0, 3, 4}, 26] (*
Ray Chandler, Aug 02 2015 *)