A382341 Triangle read by rows: T(n,k) is the number of partitions of a 4-colored set of n objects into exactly k parts with 0 <= k <= n.
1, 0, 4, 0, 10, 10, 0, 20, 40, 20, 0, 35, 135, 100, 35, 0, 56, 340, 420, 200, 56, 0, 84, 784, 1370, 950, 350, 84, 0, 120, 1596, 3900, 3580, 1800, 560, 120, 0, 165, 3070, 9905, 11835, 7425, 3045, 840, 165, 0, 220, 5500, 23180, 34780, 27020, 13360, 4760, 1200, 220
Offset: 0
Examples
Triangle starts: 0 : [1] 1 : [0, 4] 2 : [0, 10, 10] 3 : [0, 20, 40, 20] 4 : [0, 35, 135, 100, 35] 5 : [0, 56, 340, 420, 200, 56] 6 : [0, 84, 784, 1370, 950, 350, 84] 7 : [0, 120, 1596, 3900, 3580, 1800, 560, 120] 8 : [0, 165, 3070, 9905, 11835, 7425, 3045, 840, 165] 9 : [0, 220, 5500, 23180, 34780, 27020, 13360, 4760, 1200, 220] 10 : [0, 286, 9466, 50480, 94030, 87992, 51886, 21840, 7020, 1650, 286] ...
Crossrefs
Programs
-
Maple
b:= proc(n, i) option remember; expand(`if`(n=0, 1, `if`(i<1, 0, add( b(n-i*j, min(n-i*j, i-1))*binomial(i*(i^2+6*i+11)/6+j, j)*x^j, j=0..n/i)))) end: T:= (n, k)-> coeff(b(n$2), x, k): seq(seq(T(n, k), k=0..n), n=0..10); # Alois P. Heinz, Mar 22 2025
-
Mathematica
b[n_, i_] := b[n, i] = Expand[If[n == 0, 1, If[i < 1, 0, Sum[b[n - i*j, Min[n - i*j, i - 1]]*Binomial[i*(i^2 + 6*i + 11)/6 + j, j]*x^j, {j, 0, n/i}]]]]; T[n_, k_] := Coefficient[b[n, n], x, k]; Table[Table[T[n, k], {k, 0, n}], {n, 0, 10}] // Flatten (* Jean-François Alcover, Apr 17 2025, after Alois P. Heinz *)
-
Python
from sympy import binomial from sympy.utilities.iterables import partitions colors = 4 - 1 # the number of colors - 1 def t_row( n): if n == 0 : return [1] t = list( [0] * n) for p in partitions( n): fact = 1 s = 0 for k in p : s += p[k] fact *= binomial( binomial( k + colors, colors) + p[k] - 1, p[k]) if s > 0 : t[s - 1] += fact return [0] + t