Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #20 Apr 23 2016 11:16:08
%S 1,4,1248,5401472,114070692352,7593330670240768
%N Number of Dyck paths of semilength n*(4*n+1) in which the run length sequence is a permutation of {1,...,4*n}.
%e a(1) = 4: UUDUUUDDDD (2134), UUUDUUDDDD (3124), UUUUDDUDDD (4213), UUUUDDDUDD (4312).
%p h:= proc(n, s) option remember;
%p `if`(n>add(sort([s[]], `>`)[i], i=1..(nops(s)+1)/2), 0,
%p add(g(n-i, s minus {i}), i=select(x-> x<=n, s)))
%p end:
%p g:= proc(n, s) option remember;
%p `if`(s={}, `if`(n=0, 1, 0), add(h(n+i, s minus {i}), i=s))
%p end:
%p a:= n-> g(0, {$1..4*n}):
%p seq(a(n), n=0..3);
%t 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&]}] ];
%t g[n_, s_] := g[n, s] = If[s == {}, If[n == 0, 1, 0], Sum[h[n + i, s ~Complement~ {i}], {i, s}]];
%t a[n_] := g[0, Range[4*n]];
%t Table[a[n], {n, 0, 4}] (* _Jean-François Alcover_, Apr 23 2016, translated from Maple *)
%Y Cf. A007742, A060005, A073410, A168238.
%K nonn,more
%O 0,2
%A _David Scambler_ and _Alois P. Heinz_, Oct 31 2013