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.

A303160 Number of permutations p of [n] such that 0p has exactly ceiling(n/2) alternating runs.

Original entry on oeis.org

1, 1, 1, 3, 7, 43, 148, 1344, 6171, 74211, 425976, 6384708, 43979902, 789649750, 6346283560, 132789007200, 1219725741715, 29145283614115, 301190499710320, 8092186932120060, 92921064554444490, 2772830282722806978, 35025128774218944648, 1149343084932146388144
Offset: 0

Views

Author

Alois P. Heinz, Apr 19 2018

Keywords

Examples

			a(2) = 1: 12.
a(3) = 3: 132, 231, 321.
a(4) = 7: 1243, 1342, 1432, 2341, 2431, 3421, 4321.
		

Crossrefs

Bisections give: A291677 (even part), A303159 (odd part).
Cf. A186370.

Programs

  • Maple
    b:= proc(n, k) option remember; `if`(k=0,
          `if`(n=0, 1, 0), `if`(k<0 or k>n, 0,
           k*b(n-1, k)+b(n-1, k-1)+(n-k+1)*b(n-1, k-2)))
        end:
    a:= n-> b(n, ceil(n/2)):
    seq(a(n), n=0..25);
  • Mathematica
    b[n_, k_] := b[n, k] = If[k == 0,
         If[n == 0, 1, 0], If[k < 0 || k > n, 0,
         k*b[n-1, k] + b[n-1, k-1] + (n-k+1)*b[n-1, k-2]]];
    a[n_] := b[n, Ceiling[n/2]];
    Table[a[n], {n, 0, 25}] (* Jean-François Alcover, Aug 31 2021, after Alois P. Heinz *)

Formula

a(n) = A186370(n,ceiling(n/2)).