A382340 Triangle read by rows: T(n,k) is the number of partitions of a 3-colored set of n objects into exactly k parts with 0 <= k <= n.
1, 0, 3, 0, 6, 6, 0, 10, 18, 10, 0, 15, 51, 36, 15, 0, 21, 105, 123, 60, 21, 0, 28, 208, 326, 226, 90, 28, 0, 36, 360, 771, 678, 360, 126, 36, 0, 45, 606, 1641, 1836, 1161, 525, 168, 45, 0, 55, 946, 3271, 4431, 3403, 1775, 721, 216, 55, 0, 66, 1446, 6096, 10026, 8982, 5472, 2520, 948, 270, 66
Offset: 0
Examples
Triangle starts: 0 : [1] 1 : [0, 3] 2 : [0, 6, 6] 3 : [0, 10, 18, 10] 4 : [0, 15, 51, 36, 15] 5 : [0, 21, 105, 123, 60, 21] 6 : [0, 28, 208, 326, 226, 90, 28] 7 : [0, 36, 360, 771, 678, 360, 126, 36] 8 : [0, 45, 606, 1641, 1836, 1161, 525, 168, 45] 9 : [0, 55, 946, 3271, 4431, 3403, 1775, 721, 216, 55] 10 : [0, 66, 1446, 6096, 10026, 8982, 5472, 2520, 948, 270, 66] ...
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+3)/2+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 + 3)/2 + 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 = 3 - 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