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
1, 1, 1, 3, 7, 43, 148, 1344, 6171, 74211, 425976, 6384708, 43979902, 789649750, 6346283560, 132789007200, 1219725741715, 29145283614115, 301190499710320, 8092186932120060, 92921064554444490, 2772830282722806978, 35025128774218944648, 1149343084932146388144 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
LINKS
FORMULA
a(n) = A186370(n,ceiling(n/2)).
EXAMPLE
a(2) = 1: 12.
a(3) = 3: 132, 231, 321.
a(4) = 7: 1243, 1342, 1432, 2341, 2431, 3421, 4321.
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 *)
CROSSREFS
Bisections give: A291677 (even part), A303159 (odd part).
Cf. A186370.
Sequence in context: A101208 A050633 A107636 * A258435 A074268 A019026
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Apr 19 2018
STATUS
approved

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 May 6 17:20 EDT 2024. Contains 372297 sequences. (Running on oeis4.)