q[x_] := x + 2; d = 2;
p[n_, x_] := ((x + d)^n + (x - d)^n )/2 (* similar to polynomials defined at
A161516 *)
Table[Expand[p[n, x]], {n, 0, 6}]
reductionRules = {x^y_?EvenQ -> q[x]^(y/2),
x^y_?OddQ -> x q[x]^((y - 1)/2)};
t = Table[Last[Most[FixedPointList[Expand[#1 /. reductionRules] &, p[n, x]]]], {n, 0, 30}]
Table[Coefficient[Part[t, n], x, 0], {n, 1, 30}]
Table[Coefficient[Part[t, n], x, 1], {n, 1, 30}]
Join[{1}, Table[(4^n + 2*(-3)^n + 2)/6, {n, 1, 50}]] (*
G. C. Greubel, Oct 20 2018 *)