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.

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

Original entry on oeis.org

1, 1, 1, 2, 3, 11, 26, 50, 315, 1168, 3309, 7910, 78134, 431354, 1748956, 5797168, 16619603, 239887424, 1875375485, 10496708022, 47013492080, 178807998112, 599025922320, 11965846097382, 126883998286089, 947079890934441, 5574231845278396, 27500583638094490
Offset: 0

Views

Author

Alois P. Heinz, Oct 02 2013

Keywords

Examples

			a(2) = 1: 12.
a(3) = 2: 132, 231.
a(4) = 3: 1432, 2431, 3421.
a(5) = 11: 14325, 15324, 15423, 24315, 25314, 25413, 34215, 35214, 35412, 45213, 45312.
a(6) = 26: 143256, 153246, ..., 563124, 564123.
a(7) = 50: 1432567, 1532467, ..., 6741235, 6751234.
a(8) = 315: 14325687, 14325786, ..., 78613452, 78623451.
		

Crossrefs

Programs

  • Maple
    b:= proc(u, o, t, k) option remember; `if`(u+o=0, 1, add(`if`(t=k,
           b(o-j, u+j-1, 1, k+1), b(u+j-1, o-j, t+1, k)), j=1..o))
        end:
    a:= n-> b(0, n, 0, 1):
    seq(a(n), n=0..35);
  • Mathematica
    b[u_, o_, t_, k_] := b[u, o, t, k] = If[u + o == 0, 1, Sum[If[t == k, b[o - j, u + j - 1, 1, k + 1], b[u + j - 1, o - j, t + 1, k]], {j, 1, o}]];
    a[n_] := b[0, n, 0, 1];
    a /@ Range[0, 35] (* Jean-François Alcover, Mar 22 2021, after Alois P. Heinz *)