OFFSET
3,1
LINKS
Alois P. Heinz, Table of n, a(n) for n = 3..200
EXAMPLE
a(3) = 6: 123, 132, 213, 231, 312, 321.
a(4) = 11: 1243, 1342, 2341 (UUD), 1324, 1423, 2314, 2413, 3412 (UDU), 2134, 3124, 4123 (DUU).
a(5) = 29: 12435, 12534, 13245, ..., 51243, 51342, 52341.
a(6) = 99: 124356, 125346, 126345, ..., 623514, 624513, 634512.
a(7) = 367: 1243576, 1243675, 1253476, ..., 7346125, 7356124, 7456123.
MAPLE
b:= proc(u, o, t, c) option remember; `if`(u+o<c, 0,
`if`(u+o=0, `if`(c=0, 1, 0),
add(b(u+j-1, o-j, [2, 3, 3, 6, 6, 3][t],
`if`(t in [5, 6], c-1, c)), j=1..o)+
add(b(u-j, o+j-1, [4, 5, 5, 4, 4, 5][t],
`if`(t=3, c-1, c)), j=1..u)))
end:
a:= n-> add(b(j-1, n-j, 1, n-3), j=1..n):
seq(a(n), n=3..25);
MATHEMATICA
b[u_, o_, t_, c_] := b[u, o, t, c] = If[u + o < c, 0,
If[u + o == 0, If[c == 0, 1, 0],
Sum[b[u + j - 1, o - j, {2, 3, 3, 6, 6, 3}[[t]],
If[5 <= t <= 6, c - 1, c]], {j, 1, o}] +
Sum[b[u - j, o + j - 1, {4, 5, 5, 4, 4, 5}[[t]],
If[t == 3, c - 1, c]], {j, 1, u}]]];
a[n_] := Sum[b[j - 1, n - j, 1, n - 3], {j, 1, n}];
a /@ Range[3, 25] (* Jean-François Alcover, Mar 23 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 08 2013
STATUS
approved