OFFSET
5,2
COMMENTS
Consecutive patterns 12354, 21345, 54312 give the same sequence.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 5..200
EXAMPLE
a(5) = 1: 45321.
a(6) = 12: 156432, 256431, 356421, 453216, 456321, 463215, 546321, 563214, 564213, 564312, 564321, 645321.
MAPLE
b:= proc(u, o, t) option remember; `if`(u+o=0, 1, add(
b(u+j-1, o-j, `if`(u+j-3<j, 0, j)), j=1..o)+convert(series(
`if`(t=-2, x, 1)*add(b(u-j, o+j-1, `if`(j<t or t=-2, 0,
`if`(t>0, -1, `if`(t=-1, -2, 0)))), j=1..u), x, 2), polynom))
end:
a:= n-> coeff(b(n, 0$2), x, 1):
seq(a(n), n=5..25);
MATHEMATICA
b[u_, o_, t_] := b[u, o, t] = If[u + o == 0, 1, Sum[b[u + j - 1, o - j, If[u + j - 3 < j, 0, j]], {j, 1, o}] + Expand[If[t == -2, x, 1]*Sum[b[u - j, o + j - 1, If[j < t || t == -2, 0, If[t > 0, -1, If[t == -1, -2, 0]]]], {j, 1, u}]]];
a[n_] := Coefficient[b[n, 0, 0], x, 1];
Table[a[n], {n, 5, 25}] (* Jean-François Alcover, Nov 01 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Nov 27 2015
STATUS
approved