A332747 Number of compositions of n^2, such that each element of [n] is used at least once as a part.
1, 1, 3, 72, 6232, 1621620, 1241237520, 2675188471920, 15634073104902000, 239929277724680059440, 9411787539302194544158080, 922671287397731617736789070720, 221805878984619105095368813189002240, 128660270226206951104782827202740054476800
Offset: 0
Keywords
Examples
a(4) = 6232: all permutations of 4321111111, 432211111, 43222111, 4322221, 43321111, 4332211, 433321, 4432111, 443221, 543211, 64321.
Links
- Alois P. Heinz, Table of n, a(n) for n = 0..50
Programs
-
Maple
b:= proc(n, i, p, m) option remember; `if`(n=0, p!, `if`(i<1, 0, (t-> add(b(n-i*j, i-1, p+j, t)/(j+ `if`(t=0, 1, 0))!, j=0..n/i))(`if`(i>m, m, 0)))) end: a:= n-> b(n*(n-1)/2$2, n$2): seq(a(n), n=0..15);
-
Mathematica
b[n_, i_, p_, m_] := b[n, i, p, m] = If[n == 0, p!, If[i < 1, 0, Function[t, [b[n - i*j, i - 1, p + j, t]/(j + If[t == 0, 1, 0])!, {j, 0, n/i}]][If[i > m, m, 0]]]]; a[n_] := b[n(n-1)/2, n(n-1)/2, n, n]; Table[a[n], {n, 0, 15}] (* Jean-François Alcover, Sep 08 2021, after Alois P. Heinz *)
Comments