A299018 Triangle read by rows: T(n,k) is the coefficient of x^k in the polynomial P(n) = n*(x + 1)*P(n - 1) - (n - 2)^2*x*P(n - 2).
1, 2, 2, 6, 11, 6, 24, 60, 60, 24, 120, 366, 501, 366, 120, 720, 2532, 4242, 4242, 2532, 720, 5040, 19764, 38268, 46863, 38268, 19764, 5040, 40320, 172512, 373104, 528336, 528336, 373104, 172512, 40320, 362880, 1668528, 3942108, 6237828, 7213761, 6237828, 3942108, 1668528, 362880
Offset: 1
Examples
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]
Crossrefs
Programs
-
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 *)
-
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)
Formula
P(0) = 0, P(1) = 1 and P(n) = n * (x + 1) * P(n - 1) - (n - 2)^2 * x * P(n - 2).