login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A303160 Number of permutations p of [n] such that 0p has exactly ceiling(n/2) alternating runs. 4

%I #12 Aug 31 2021 07:42:02

%S 1,1,1,3,7,43,148,1344,6171,74211,425976,6384708,43979902,789649750,

%T 6346283560,132789007200,1219725741715,29145283614115,301190499710320,

%U 8092186932120060,92921064554444490,2772830282722806978,35025128774218944648,1149343084932146388144

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

%H Alois P. Heinz, <a href="/A303160/b303160.txt">Table of n, a(n) for n = 0..456</a>

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

%e a(2) = 1: 12.

%e a(3) = 3: 132, 231, 321.

%e a(4) = 7: 1243, 1342, 1432, 2341, 2431, 3421, 4321.

%p b:= proc(n, k) option remember; `if`(k=0,

%p `if`(n=0, 1, 0), `if`(k<0 or k>n, 0,

%p k*b(n-1, k)+b(n-1, k-1)+(n-k+1)*b(n-1, k-2)))

%p end:

%p a:= n-> b(n, ceil(n/2)):

%p seq(a(n), n=0..25);

%t b[n_, k_] := b[n, k] = If[k == 0,

%t If[n == 0, 1, 0], If[k < 0 || k > n, 0,

%t k*b[n-1, k] + b[n-1, k-1] + (n-k+1)*b[n-1, k-2]]];

%t a[n_] := b[n, Ceiling[n/2]];

%t Table[a[n], {n, 0, 25}] (* _Jean-François Alcover_, Aug 31 2021, after _Alois P. Heinz_ *)

%Y Bisections give: A291677 (even part), A303159 (odd part).

%Y Cf. A186370.

%K nonn

%O 0,4

%A _Alois P. Heinz_, Apr 19 2018

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 11:59 EDT 2024. Contains 371254 sequences. (Running on oeis4.)