OFFSET
0,3
MAPLE
b:= proc(n, i, p, f, g) option remember; `if`(f intersect g<>{}, 0,
`if`(n=0, p!, `if`(i<1, 0, add(b(n-i*j, i-1, p+j, `if`(j=0,
f, {f[], i}), `if`(j=0, g, {g[], j}))/j!, j=0..n/i))))
end:
a:= n-> b(n$2, 0, {}$2):
seq(a(n), n=0..32);
MATHEMATICA
b[n_, i_, p_, f_, g_] := b[n, i, p, f, g] = If[f ~Intersection~ g != {}, 0,
If[n == 0, p!, If[i < 1, 0, Sum[b[n - i*j, i - 1, p + j,
If[j == 0, f, Union@Append[f, i]],
If[j == 0, g, Union@Append[g, j]]]/j!, {j, 0, n/i}]]]];
a[n_] := b[n, n, 0, {}, {}];
Table[a[n], {n, 0, 38}] (* Jean-François Alcover, Apr 13 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jul 07 2020
STATUS
approved