OFFSET
0,3
LINKS
Wikipedia, Partition of a set
EXAMPLE
a(4) = 13: 123|4, 124|3, 12|34, 12|3|4, 134|2, 13|24, 13|2|4, 14|23, 1|23|4, 14|2|3, 1|24|3, 1|2|34, 1|2|3|4.
MAPLE
b:= proc(n, l) option remember; `if`(n=0, 1, `if`(n=1, 1,
b(n-1, sort([l[], n])))+add(`if`(n<=l[j], `if`(n=1, 1,
b(n-1, sort(subsop(j=l[j]-n, l)))), 0), j=1..nops(l)))
end:
a:= n-> b(n, []):
seq(a(n), n=0..15);
MATHEMATICA
b[n_, l_] := b[n, l] = If[n == 0, 1, If[n == 1, 1,
b[n-1, Sort[Append[l, n]]]] + Sum[If[n <= l[[j]], If[n == 1, 1,
b[n-1, Sort[ReplacePart[l, j -> l[[j]] - n]]]], 0], {j, 1, Length[l]}]];
a[n_] := b[n, {}];
Table[Print[n, " ", a[n]]; a[n], {n, 0, 15}] (* Jean-François Alcover, Aug 29 2024, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 23 2024
STATUS
approved