OFFSET
0,6
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..185
FORMULA
a(n) ~ c * (2/Pi)^n * n! * n^2, where c = 1.286210080518397686... . - Vaclav Kotesovec, Aug 28 2014
EXAMPLE
a(4) = 1: 1234.
a(5) = 14: 12354, 12453, 12543, 13452, 13542, 14532, 21345, 23451, 23541, 24531, 31245, 34521, 41235, 51234.
MAPLE
b:= proc(u, o, t, c) option remember;
`if`(c<0, 0, `if`(u+o=0, `if`(c=0, 1, 0),
add(b(u+j-1, o-j, [2, 2, 2][t], `if`(t=2, c-1, c)), j=1..o)+
add(b(u-j, o+j-1, [1, 3, 1][t], `if`(t=3, c-1, c)), j=1..u)))
end:
a:= n-> b(n, 0, 1, 2):
seq(a(n), n=0..25);
MATHEMATICA
b[u_, o_, t_, c_] := b[u, o, t, c] =
If[c<0, 0, If[u+o == 0, If[c == 0, 1, 0],
Sum[b[u+j-1, o-j, 2, If[t == 2, c-1, c]], {j, 1, o}] +
Sum[b[u-j, o+j-1, {1, 3, 1}[[t]], If[t == 3, c-1, c]], {j, 1, u}]]];
a[n_] := b[n, 0, 1, 2];
Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Dec 20 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 09 2013
STATUS
approved