A382045 Triangle read by rows: T(n,k) is the number of partitions of a 3-colored set of n objects into at most k parts with 0 <= k <= n.
1, 0, 3, 0, 6, 12, 0, 10, 28, 38, 0, 15, 66, 102, 117, 0, 21, 126, 249, 309, 330, 0, 28, 236, 562, 788, 878, 906, 0, 36, 396, 1167, 1845, 2205, 2331, 2367, 0, 45, 651, 2292, 4128, 5289, 5814, 5982, 6027, 0, 55, 1001, 4272, 8703, 12106, 13881, 14602, 14818, 14873, 0, 66, 1512, 7608, 17634, 26616, 32088, 34608, 35556, 35826, 35892
Offset: 0
Examples
Triangle starts: 0 : [1] 1 : [0, 3] 2 : [0, 6, 12] 3 : [0, 10, 28, 38] 4 : [0, 15, 66, 102, 117] 5 : [0, 21, 126, 249, 309, 330] 6 : [0, 28, 236, 562, 788, 878, 906] 7 : [0, 36, 396, 1167, 1845, 2205, 2331, 2367] 8 : [0, 45, 651, 2292, 4128, 5289, 5814, 5982, 6027] 9 : [0, 55, 1001, 4272, 8703, 12106, 13881, 14602, 14818, 14873] 10 : [0, 66, 1512, 7608, 17634, 26616, 32088, 34608, 35556, 35826, 35892] ...
Links
- Alois P. Heinz, Rows n = 0..150, flattened
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:= proc(n, k) option remember; `if`(k<0, 0, T(n, k-1)+coeff(b(n$2), x, k)) end: seq(seq(T(n, k), k=0..n), n=0..10); # Alois P. Heinz, Mar 13 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_] := T[n, k] = If[k < 0, 0, T[n, k-1] + Coefficient[b[n, n], x, k]]; Table[Table[T[n, k], {k, 0, n}], {n, 0, 10}] // Flatten (* Jean-François Alcover, Mar 21 2025, after Alois P. Heinz *)
-
Python
from sympy import binomial from sympy.utilities.iterables import partitions from sympy.combinatorics.partitions import IntegerPartition 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): p = IntegerPartition( p).as_dict() 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 for i in range( n - 1): t[i+1] += t[i] return [0] + t
Formula
T(n,1) = binomial(n + 2, 2) = A000217(n + 1) for n >= 1.
Comments