OFFSET
0,5
LINKS
P. A. MacMahon, Divisors of numbers and their continuations in the theory of partitions, Proc. London Math. Soc., (2) 19 (1919), 75-113; Coll. Papers II, pp. 303-341.
FORMULA
T(n, k) = [t^k][x^n] Product_{j>=1}(1 + t*x^j / (1 - x^j).
T(n, k) = 0 for n>0 and k=0. T(n,k) = 0 for k > floor([sqrt(1+8n)-1]/2). - Chai Wah Wu, Sep 15 2023
EXAMPLE
Triangle T(n, k) starts:
[0] 1;
[1] 0, 1;
[2] 0, 2, 0;
[3] 0, 2, 1, 0;
[4] 0, 3, 2, 0, 0;
[5] 0, 2, 5, 0, 0, 0;
[6] 0, 4, 6, 1, 0, 0, 0;
[7] 0, 2, 11, 2, 0, 0, 0, 0;
[8] 0, 4, 13, 5, 0, 0, 0, 0, 0;
[9] 0, 3, 17, 10, 0, 0, 0, 0, 0, 0;
MAPLE
P := proc(n, k, r) option remember; local j; # after Amir Livne Bar-on
if n = 0 then return ifelse(k = 0, 1, 0) fi;
if k = 0 or r = 0 then return 0 fi;
add(P(n - r * j, k - 1, r - 1), j = 1..iquo(n, r)) + P(n, k, r - 1) end:
A365676row := n -> local k; seq(P(n, k, n), k = 0..n):
seq(print(A365676row(n)), n = 0..9);
# Using the generating function:
p := product(1 + t*x^j/(1 - x^j), j = 1..20):
ser := series(p, x, 20):
seq(seq(coeff(coeff(ser, x, n), t, k), k = 0..n), n = 0..9);
MATHEMATICA
P[n_, k_, r_] := P[n, k, r] = Which[n == 0, If[k == 0, 1, 0], k == 0 || r == 0, 0, True, Sum[P[n-r*j, k-1, r-1], {j, 1, Quotient[n, r]}]+P[n, k, r-1]]; A365676row[n_] := Table[P[n, k, n], {k, 0, n}]; Table[A365676row[n], {n, 0, 12}] // Flatten (* Jean-François Alcover, Oct 21 2023, from 1st Maple program *)
PROG
(Python) # after Amir Livne Bar-on
from functools import cache
@cache
def P(n: int, k: int, r: int) -> int:
if n == 0: return 1 if k == 0 else 0
if k == 0 or r == 0: return 0
return sum(P(n - r * j, k - 1, r - 1)
for j in range(1, n // r + 1)) + P(n, k, r - 1)
def A365676Row(n) -> list[int]:
return [P(n, k, n) for k in range(n + 1)]
for n in range(10): print(A365676Row(n))
(PARI) T(n, k) = my(nb=0); forpart(p=n, if (#Set(p) == k, nb++)); nb; \\ Michel Marcus, Sep 17 2023
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Peter Luschny, Sep 15 2023
STATUS
approved