OFFSET
1,2
FORMULA
P(0) = 0, P(1) = 1 and P(n) = n * (x + 1) * P(n - 1) - (n - 2)^2 * x * P(n - 2).
EXAMPLE
For n = 3, the polynomial is 6*x^2 + 11*x + 6.
The first few polynomials, as a table:
[1],
[2, 2],
[6, 11, 6],
[24, 60, 60, 24],
[120, 366, 501, 366, 120]
MAPLE
P:= proc(n) option remember; expand(`if`(n<2, n,
n*(x+1)*P(n-1)-(n-2)^2*x*P(n-2)))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=0..n-1))(P(n)):
seq(T(n), n=1..12); # Alois P. Heinz, Jan 31 2018
A := proc(n, k) ## n >= 0 and k = 0 .. n
option remember;
if n = 0 and k = 0 then
1
elif n > 0 and k >= 0 and k <= n then
(n+1)*(A(n-1, k)+A(n-1, k-1))-(n-1)^2*A(n-2, k-1)
else
0
end if;
end proc: # Yu-Sheng Chang, Apr 14 2020
MATHEMATICA
P[n_] := P[n] = Expand[If[n < 2, n, n (x+1) P[n-1] - (n-2)^2 x P[n-2]]];
row[n_] := CoefficientList[P[n], x];
row /@ Range[12] // Flatten (* Jean-François Alcover, Dec 10 2019 *)
PROG
(Sage)
@cached_function
def poly(n):
x = polygen(ZZ, 'x')
if n < 1:
return x.parent().zero()
elif n == 1:
return x.parent().one()
else:
return n * (x + 1) * poly(n - 1) - (n - 2)**2 * x * poly(n - 2)
CROSSREFS
KEYWORD
AUTHOR
F. Chapoton, Jan 31 2018
STATUS
approved