OFFSET
0,5
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..650
Wikipedia, Partition of a set
FORMULA
a(n) = Sum_{k=0..floor(n/2)} Stirling2(floor(n/2),k) * Stirling2(ceiling(n/2),k).
a(2n) = A047797(n).
EXAMPLE
a(0) = 1: () the empty partition.
a(1) = 0.
a(2) = 1: 1|2.
a(3) = 1: 13|2.
a(4) = 2: 13|24, 1|2|3|4.
a(5) = 4: 135|24, 13|2|4|5, 15|2|3|4, 1|2|35|4.
a(6) = 11: 135|246, 13|24|5|6, 13|26|4|5, 13|2|46|5, 15|24|3|6, 1|24|35|6, 15|26|3|4, 15|2|3|46, 1|26|35|4, 1|2|35|46, 1|2|3|4|5|6.
a(7) = 28: 1357|246, 135|24|6|7, 137|24|5|6, 13|24|57|6, 135|26|4|7, 135|2|46|7, 137|26|4|5, 13|26|4|57, 137|2|46|5, 13|2|46|57, 13|2|4|5|6|7, 157|24|3|6, 15|24|37|6, 17|24|35|6, 1|24|357|6, 157|26|3|4, 15|26|37|4, 157|2|3|46, 15|2|37|46, 15|2|3|4|6|7, 17|26|35|4, 1|26|357|4, 17|2|35|46, 1|2|357|46, 1|2|35|4|6|7, 17|2|3|4|5|6, 1|2|37|4|5|6, 1|2|3|4|57|6.
MAPLE
a:= n-> (h-> add(Stirling2(h, k)*Stirling2(n-h, k), k=0..h))(iquo(n, 2)):
seq(a(n), n=0..40);
# second Maple program:
b:= proc(n, x, y) option remember; `if`(abs(x-y)>n, 0,
`if`(n=0, 1, `if`(x>0, b(n-1, y, x)*x, 0)+b(n-1, y, x+1)))
end:
a:= n-> b(n, 0$2):
seq(a(n), n=0..40);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 02 2023
STATUS
approved