cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A247550 Number of 1 up, 1 down, 2 up, 1 down, 3 up, 1 down, ... permutations of [n].

Original entry on oeis.org

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

Views

Author

Alois P. Heinz, Sep 19 2014

Keywords

Examples

			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.
		

Crossrefs

Cf. A229551.

Programs

  • 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 *)