OFFSET
0,2
EXAMPLE
a(1) = 4: UUDUUUDDDD (2134), UUUDUUDDDD (3124), UUUUDDUDDD (4213), UUUUDDDUDD (4312).
MAPLE
h:= proc(n, s) option remember;
`if`(n>add(sort([s[]], `>`)[i], i=1..(nops(s)+1)/2), 0,
add(g(n-i, s minus {i}), i=select(x-> x<=n, s)))
end:
g:= proc(n, s) option remember;
`if`(s={}, `if`(n=0, 1, 0), add(h(n+i, s minus {i}), i=s))
end:
a:= n-> g(0, {$1..4*n}):
seq(a(n), n=0..3);
MATHEMATICA
h[n_, s_] := h[n, s] = If[n > Sum[Sort[s, Greater][[i]], {i, 1, (Length[s] + 1)/2}], 0, Sum[g[n - i, s ~Complement~ {i}], {i, Select[s, # <= n&]}] ];
g[n_, s_] := g[n, s] = If[s == {}, If[n == 0, 1, 0], Sum[h[n + i, s ~Complement~ {i}], {i, s}]];
a[n_] := g[0, Range[4*n]];
Table[a[n], {n, 0, 4}] (* Jean-François Alcover, Apr 23 2016, translated from Maple *)
CROSSREFS
KEYWORD
nonn,more
AUTHOR
David Scambler and Alois P. Heinz, Oct 31 2013
STATUS
approved