OFFSET
0,3
COMMENTS
a(0) = 1 by convention.
a(n) >= n! = A000142(n).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..100
EXAMPLE
a(1) = 1: (1).
a(2) = 3: (12), (2)(1).
a(3) = 8: (123), (13)2, 2(13), (23)1, 3(12), (3)(2)(1).
MAPLE
b:= proc(u, o, l, m, c) option remember; `if`(u+o=0, `if`(l>m, 1,
`if`(l<m, c, c+1)), add(b(u-j, o+j-1, 1, max(l, m),
`if`(l>m, 1, `if`(l<m, c, c+1))), j=1..u)+
add(b(u+j-1, o-j, l+1, m, c), j=1..o))
end:
a:= n-> b(n, 0$4):
seq(a(n), n=0..25);
MATHEMATICA
b[u_, o_, l_, m_, c_] := b[u, o, l, m, c] = If[u + o == 0, If[l > m, 1,
If[l < m, c, c + 1]], Sum[b[u - j, o + j - 1, 1, Max[l, m],
If[l > m, 1, If[l < m, c, c + 1]]], {j, 1, u}] +
Sum[b[u+j-1, o-j, l+1, m, c], {j, 1, o}]];
a[n_] := b[n, 0, 0, 0, 0];
Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Apr 15 2022, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Jun 07 2015
STATUS
approved