OFFSET
0,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..275
EXAMPLE
a(5) = 9: 13245, 14235, 15234, 23145, 24135, 25134, 34125, 35124, 45123.
a(6) = 40: 132465, 132564, 142365, 142563, 143562, 152364, 152463, 153462, 162354, 162453, 163452, 231465, 231564, 241365, 241563, 243561, 251364, 251463, 253461, 261354, 261453, 263451, 341265, 341562, 342561, 351264, 351462, 352461, 361254, 361452, 362451, 451263, 451362, 452361, 461253, 461352, 462351, 561243, 561342, 562341.
MAPLE
b:= proc(u, o, t, k) option remember; `if`(u+o=0, 1, `if`(t>0,
add(b(u+j-1, o-j, `if`(t=k, 0, t+1), k), j=1..o),
add(b(u-j, o+j-1, 1, k+1), j=1..u)))
end:
a:= n-> b(n, 0$3):
seq(a(n), n=0..35);
MATHEMATICA
b[u_, o_, t_, k_] := b[u, o, t, k] = If[u + o == 0, 1, If[t > 0,
Sum[b[u + j - 1, o - j, If[t == k, 0, t + 1], k], {j, 1, o}],
Sum[b[u - j, o + j - 1, 1, k + 1], {j, 1, u}]]];
a[n_] := b[n, 0, 0, 0];
a /@ Range[0, 35] (* Jean-François Alcover, Mar 26 2021, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Sep 19 2014
STATUS
approved