OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..250
Wikipedia, Partition of a set
FORMULA
EXAMPLE
a(3) = 2 = 0 + 0 + 1 + 0 + 1 : 123, 12|3, 13|2, 1|23, 1|2|3.
MAPLE
b:= proc(n, k) local g, u; g:= floor(n/2); u:=ceil(n/2);
add(Stirling2(i, k)*binomial(g, i)*
add(Stirling2(u, j)*j^(g-i), j=0..u), i=k..g)
end:
a:= n-> add(b(n, k)*k, k=0..floor(n/2)):
seq(a(n), n=0..25);
# second Maple program:
b:= proc(n, x, y, m) option remember; `if`(n=0, x,
`if`(x+m>0, b(n-1, y, x, m)*(x+m), 0)+b(n-1, y, x+1, m)+
`if`(y>0, b(n-1, y-1, x, m+1)*y, 0))
end:
a:= n-> b(n, 0$3):
seq(a(n), n=0..25);
MATHEMATICA
b[n_, x_, y_, m_] := b[n, x, y, m] = If[n == 0, x,
If[x+m > 0, b[n-1, y, x, m]*(x+m), 0] + b[n-1, y, x+1, m] +
If[y > 0, b[n-1, y-1, x, m+1]*y, 0]];
a[n_] := b[n, 0, 0, 0];
Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Dec 08 2023, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 02 2023
STATUS
approved