OFFSET
0,6
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..462
FORMULA
a(n) ~ c * (3*sqrt(3)/(2*Pi))^n * n! * n^2, where c = 0.0359701024355206... . - Vaclav Kotesovec, Sep 06 2014
EXAMPLE
a(4) = 1: 1234.
a(5) = 8: 12354, 12453, 13452, 21345, 23451, 31245, 41235, 51234.
a(6) = 86: 123546, 123645, 123654, ..., 631245, 641235, 651234.
a(7) = 803: 1235476, 1236475, 1236547, ..., 7631245, 7641235, 7651234.
MAPLE
b:= proc(u, o, t) option remember;
`if`(t=7, 0, `if`(u+o=0, `if`(t in [4, 6], 1, 0),
add(b(u-j, o+j-1, [1, 1, 5, 6, 5, 6][t]), j=1..u)+
add(b(u+j-1, o-j, [2, 3, 4, 7, 3, 4][t]), j=1..o)))
end:
a:= n-> b(n, 0, 1):
seq(a(n), n=0..25);
MATHEMATICA
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1,
Sum[b[u - j, o + j - 1, 1], {j, 1, u}] +
Sum[b[u + j - 1, o - j, 2]*If[t == 2, x, 1], {j, 1, o}] // Expand];
a[n_] := Coefficient[b[n, 0, 1], x, 2];
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Oct 25 2013
STATUS
approved