A383352 Triangle read by rows: T(n, k) is the number of partitions of a 2-colored set of n objects into at most k parts where 0 <= k <= n, and each part is one of 2 kinds.
1, 0, 4, 0, 6, 16, 0, 8, 32, 52, 0, 10, 63, 123, 158, 0, 12, 100, 264, 384, 440, 0, 14, 158, 506, 876, 1086, 1170, 0, 16, 224, 896, 1800, 2500, 2836, 2956, 0, 18, 317, 1491, 3489, 5359, 6542, 7046, 7211, 0, 20, 420, 2372, 6324, 10848, 14208, 16056, 16776, 16996
Offset: 0
Examples
Triangle starts: 0 : [1] 1 : [0, 4] 2 : [0, 6, 16] 3 : [0, 8, 32, 52] 4 : [0, 10, 63, 123, 158] 5 : [0, 12, 100, 264, 384, 440] 6 : [0, 14, 158, 506, 876, 1086, 1170] 7 : [0, 16, 224, 896, 1800, 2500, 2836, 2956] 8 : [0, 18, 317, 1491, 3489, 5359, 6542, 7046, 7211] 9 : [0, 20, 420, 2372, 6324, 10848, 14208, 16056, 16776, 16996] 10 : [0, 22, 556, 3608, 11002, 20836, 29488, 34976, 37700, 38690, 38976] ...
Programs
-
Python
from sympy import binomial from sympy.utilities.iterables import partitions def calc_w(k , m): s = 0 for p in partitions(m, m=k+1): fact = 1 j = k + 1 for x in p : fact *= binomial(j, p[x]) * (x + 1) ** p[x] j -= p[x] s += fact return s 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 *= calc_w(k, 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,k) = Sum_{i=0..k} A383351(n,i).
T(n,1) = 2*n + 2 for n >= 1.