A365676 Triangle read by rows: T(n, k) is the number of partitions of n having exactly k distinct part sizes, for 0 <= k <= n.
1, 0, 1, 0, 2, 0, 0, 2, 1, 0, 0, 3, 2, 0, 0, 0, 2, 5, 0, 0, 0, 0, 4, 6, 1, 0, 0, 0, 0, 2, 11, 2, 0, 0, 0, 0, 0, 4, 13, 5, 0, 0, 0, 0, 0, 0, 3, 17, 10, 0, 0, 0, 0, 0, 0, 0, 4, 22, 15, 1, 0, 0, 0, 0, 0, 0, 0, 2, 27, 25, 2, 0, 0, 0, 0, 0, 0, 0, 0, 6, 29, 37, 5, 0, 0, 0, 0, 0, 0, 0, 0
Offset: 0
Examples
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;
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.
Crossrefs
Programs
-
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 *)
-
PARI
T(n,k) = my(nb=0); forpart(p=n, if (#Set(p) == k, nb++)); nb; \\ Michel Marcus, Sep 17 2023
-
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))
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