OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..250
Wikipedia, Partition of a set
FORMULA
EXAMPLE
a(3) = 7 = 0 + 1 + 2 + 1 + 3 : 123, 12|3, 13|2, 1|23, 1|2|3.
MAPLE
b:= proc(n, e, o, m) option remember; `if`(n=0, e+o,
(e+m)*b(n-1, o, e, m)+b(n-1, o, e+1, m)+
`if`(o=0, 0, o*b(n-1, o-1, e, m+1)))
end:
a:= n-> b(n, 0$3):
seq(a(n), n=0..24);
MATHEMATICA
b[n_, e_, o_, m_] := b[n, e, o, m] = If[n == 0, e + o, (e + m)*b[n-1, o, e, m] + b[n - 1, o, e + 1, m] + If[o == 0, 0, o*b[n - 1, o - 1, e, m + 1]]];
a[n_] := b[n, 0, 0, 0];
Table[a[n], {n, 0, 24}] (* Jean-François Alcover, Sep 10 2023, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 01 2023
STATUS
approved