OFFSET
0,3
LINKS
Wikipedia, Partition of a set
EXAMPLE
MAPLE
b:= proc(n, i, m, l) option remember; `if`(n=0,
`if`({l[], 1}={1}, 1, 0), add(`if`(j<m+1 and
j=i+1 and l[j]=1, 0, b(n-1, j, max(m, j),
`if`(j=m+1, [l[], `if`(j=i+1, 1, 0)],
`if`(j=i+1, subsop(j=1, l), l)))), j=1..m+1))
end:
a:= n-> b(n, 0$2, []):
seq(a(n), n=0..18);
MATHEMATICA
b[n_, i_, m_, l_] := b[n, i, m, l] = If[n==0, If[Union[Append[l, 1]] == {1}, 1, 0], Sum[If[j<m+1 && j==i+1 && l[[j]]==1, 0, b[n-1, j, Max[m, j], If[j==m+1, Append[l, If[j==i+1, 1, 0]], If[j==i+1, ReplacePart[l, j -> 1], l]]]], {j, 1, m+1}]]; a[n_] := b[n, 0, 0, {}]; Table[a[n], {n, 0, 18}] (* Jean-François Alcover, Feb 03 2017, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 19 2016
STATUS
approved