The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A291677 Number of permutations p of [2n] such that 0p has exactly n alternating runs. 4
1, 1, 7, 148, 6171, 425976, 43979902, 6346283560, 1219725741715, 301190499710320, 92921064554444490, 35025128774218944648, 15838288022236083603486, 8462453158197423495502224, 5274234568391796228927038748, 3792391176672742840187796835728 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
FORMULA
a(n) = A186370(2n,n).
a(n) ~ c * d^n * n! * (n-1)!, where d = 3.4210546206711870249402157940795853513... and c = 0.32723781013647536133280275922604008889245... - Vaclav Kotesovec, Apr 29 2018
EXAMPLE
a(2) = 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(2*n, n):
seq(a(n), n=0..20);
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[2*n, n]; Table[a[n], {n, 0, 20}] (* Jean-François Alcover, May 30 2019, after Alois P. Heinz *)
PROG
(Python)
from sympy.core.cache import cacheit
@cacheit
def b(n, k): return (1 if n==0 else 0) if k==0 else 0 if k<0 or k>n else k*b(n - 1, k) + b(n - 1, k - 1) + (n - k + 1)*b(n - 1, k - 2)
def a(n): return b(2*n, n)
print([a(n) for n in range(31)]) # Indranil Ghosh, Aug 30 2017
CROSSREFS
Cf. A186370.
Bisection (even part) of A303160.
Sequence in context: A211108 A251668 A048935 * A152552 A349286 A308581
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Aug 29 2017
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 14 10:07 EDT 2024. Contains 372532 sequences. (Running on oeis4.)