login
A247550
Number of 1 up, 1 down, 2 up, 1 down, 3 up, 1 down, ... permutations of [n].
2
1, 1, 1, 2, 5, 9, 40, 169, 477, 1099, 8766, 56341, 234717, 774279, 2182270, 27260478, 249339033, 1457282467, 6624389780, 25274016620, 84400336507, 1518975557185, 18799199683021, 147690564521818, 892559422156897, 4474464873070564, 19410417198316364
OFFSET
0,4
LINKS
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
Cf. A229551.
Sequence in context: A090291 A161137 A229551 * A249583 A109469 A334986
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Sep 19 2014
STATUS
approved