A242887 Number T(n,k) of compositions of n into parts with distinct multiplicities and with exactly k parts; triangle T(n,k), n>=0, 0<=k<=n, read by rows.
1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 3, 1, 0, 1, 0, 6, 4, 1, 0, 1, 1, 4, 4, 5, 1, 0, 1, 0, 9, 8, 15, 6, 1, 0, 1, 1, 9, 5, 15, 21, 7, 1, 0, 1, 0, 10, 8, 20, 6, 28, 8, 1, 0, 1, 1, 12, 12, 6, 96, 42, 36, 9, 1, 0, 1, 0, 15, 12, 30, 192, 168, 64, 45, 10, 1, 0, 1, 1, 13, 9, 20, 142, 238, 204, 93, 55, 11, 1
Offset: 0
Examples
T(5,1) = 1: [5]. T(5,3) = 6: [1,2,2], [2,1,2], [2,2,1], [1,1,3], [1,3,1], [3,1,1]. T(5,4) = 4: [1,1,1,2], [1,1,2,1], [1,2,1,1], [2,1,1,1]. T(5,5) = 1: [1,1,1,1,1]. Triangle T(n,k) begins: 1; 0, 1; 0, 1, 1; 0, 1, 0, 1; 0, 1, 1, 3, 1; 0, 1, 0, 6, 4, 1; 0, 1, 1, 4, 4, 5, 1; 0, 1, 0, 9, 8, 15, 6, 1; 0, 1, 1, 9, 5, 15, 21, 7, 1; 0, 1, 0, 10, 8, 20, 6, 28, 8, 1; 0, 1, 1, 12, 12, 6, 96, 42, 36, 9, 1;
Links
- Alois P. Heinz, Rows n = 0..140, flattened
Crossrefs
Programs
-
Maple
b:= proc(n, i, s) option remember; `if`(n=0, add(j, j=s)!, `if`(i<1, 0, expand(add(`if`(j>0 and j in s, 0, x^j* b(n-i*j, i-1,`if`(j=0, s, s union {j}))/j!), j=0..n/i)))) end: T:= n-> (p-> seq(coeff(p,x,i), i=0..degree(p)))(b(n$2, {})): seq(T(n), n=0..16);
-
Mathematica
b[n_, i_, s_] := b[n, i, s] = If[n==0, Total[s]!, If[i<1, 0, Expand[Sum[ If[j>0 && MemberQ[s, j], 0, x^j*b[n-i*j, i-1, If[j==0, s, s ~Union~ {j}] ]/j!], {j, 0, n/i}]]]]; T[n_] := Function[p, Table[Coefficient[p, x, i], {i, 0, Exponent[p, x]}]][b[n, n, {}]]; Table[T[n], {n, 0, 16}] // Flatten (* Jean-François Alcover, Feb 08 2017, translated from Maple *)
-
PARI
T(n)={Vecrev(((r,k,b,w)->if(!k||!r, if(r,0,w!*x^w), sum(m=0, r\k, if(!m || !bittest(b,m), self()(r-k*m, k-1, bitor(b,1<
Andrew Howroyd, Aug 31 2019