OFFSET
0,5
COMMENTS
A combination of a multiset M is an unordered selection of k objects of M, where every object can appear at most as many times as it appears in M.
A(n, k) = Cardinality(Union_{j=0..k} Combination(MultiSet(1^[j*n], 0^[(k-j)*n]))), where MultiSet(r^[s], u^[v]) denotes a set that contains the element r with multiplicity s and the element u with multiplicity v; thus the multisets under consideration have n*k elements. Since the base set is {1, 0} the elements can be represented as binary strings. Applying the combination operator to the multisets results in a set of binary strings where '0' resp. '1' can appear at most j*n resp. (k-j)*n times. 'At most' means that they do not have to appear; in other words, the resulting set always includes the empty string ''.
In contrast to the procedure in A361045 we consider here the cardinality of the set union and not the sum of the individual cardinalities. If you want to exclude the empty string, you will find the sequences listed in A361521. The same construction with multiset permutations instead of multiset combinations results in A361043.
FORMULA
A(n, k) = 1 + n*k*(4 + n*(k - 1))/2.
T(n, k) = 1 + k*(n - k)*(4 + k*(n - k - 1))/2.
A(n, k) = [x^k] (1 + (n - 1)*x)^2 / (1 - x)^3.
A(n, k) = hypergeom([-k, -2], [1], n).
A(n, k) = A361521(n, k) + 1.
EXAMPLE
Array A(n, k) starts:
[0] 1, 1, 1, 1, 1, 1, 1, 1, ... A000012
[1] 1, 3, 6, 10, 15, 21, 28, 36, ... A000217
[2] 1, 5, 13, 25, 41, 61, 85, 113, ... A001844
[3] 1, 7, 22, 46, 79, 121, 172, 232, ... A038764
[4] 1, 9, 33, 73, 129, 201, 289, 393, ... A081585
[5] 1, 11, 46, 106, 191, 301, 436, 596, ... A081587
[6] 1, 13, 61, 145, 265, 421, 613, 841, ... A081589
[7] 1, 15, 78, 190, 351, 561, 820, 1128, ... A081591
.
Triangle T(n, k) starts:
[0] 1;
[1] 1, 1;
[2] 1, 3, 1;
[3] 1, 6, 5, 1;
[4] 1, 10, 13, 7, 1;
[5] 1, 15, 25, 22, 9, 1;
[6] 1, 21, 41, 46, 33, 11, 1;
[7] 1, 28, 61, 79, 73, 46, 13, 1;
[8] 1, 36, 85, 121, 129, 106, 61, 15, 1;
[9] 1, 45, 113, 172, 201, 191, 145, 78, 17, 1.
.
Row 4 of the triangle:
A(0, 4) = 1 = card('').
A(1, 3) = 10 = card('', 0, 00, 000, 1, 10, 100, 11, 110, 111).
A(2, 2) = 13 = card('', 0, 00, 000, 0000, 1, 10, 100, 11, 110, 1100, 111, 1111).
A(3, 1) = 7 = card('', 0, 00, 000, 1, 11, 111).
A(4, 0) = 1 = card('').
MAPLE
A := (n, k) -> 1 + n*k*(4 + n*(k - 1))/2:
for n from 0 to 7 do seq(A(n, k), k = 0..7) od;
# Alternative:
ogf := n -> (1 + (n - 1)*x)^2 / (1 - x)^3:
ser := n -> series(ogf(n), x, 12):
row := n -> seq(coeff(ser(n), x, k), k = 0..9):
seq(print(row(n)), n = 0..7);
PROG
(SageMath)
def A(m: int, steps: int) -> int:
if m == 0: return 1
size = m * steps
cset = set()
for a in range(0, size + 1, m):
S = [str(int(i < a)) for i in range(size)]
C = Combinations(S)
cset.update("".join(i for i in c) for c in C)
return len(cset)
def ARow(n: int, size: int) -> list[int]:
return [A(n, k) for k in range(size + 1)]
for n in range(8): print(ARow(n, 7))
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Mar 21 2023
STATUS
approved