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!)
A152875 Number of permutations of {1,2,...,n} with all odd entries preceding all even entries or all even entries preceding all odd entries. 3

%I #24 Aug 16 2023 12:28:21

%S 1,1,2,4,8,24,72,288,1152,5760,28800,172800,1036800,7257600,50803200,

%T 406425600,3251404800,29262643200,263363788800,2633637888000,

%U 26336378880000,289700167680000,3186701844480000,38240422133760000,458885065605120000,5965505852866560000

%N Number of permutations of {1,2,...,n} with all odd entries preceding all even entries or all even entries preceding all odd entries.

%C a(n) = A152874(n,1).

%H Alois P. Heinz, <a href="/A152875/b152875.txt">Table of n, a(n) for n = 0..506</a>

%F a(2n) = 2n!^2; a(2n+1) = 2n!(n+1)! (for n>=2).

%F E.g.f.: 1+x+2*(4*sqrt(4-x^2)*arcsin(x/2) - 4x + 4x^2 + x^3 - x^4)/((2+x)*(2-x)^2).

%F D-finite with recurrence 4*a(n) -2*a(n-1) -n*(n-1)*a(n-2)=0. - _R. J. Mathar_, Jul 22 2022

%e a(4)=8 because we have 1324, 1342, 3124, 3142, 2413, 2431, 4213 and 4231.

%p a := proc (n) if `mod`(n, 2) = 0 then 2*factorial((1/2)*n)^2 else 2*factorial((1/2)*n-1/2)*factorial((1/2)*n+1/2) end if end proc: seq(a(n), n = 2 .. 25);

%p # second Maple program:

%p a:= n-> (h-> 2^signum(h)*h!*(n-h)!)(iquo(n, 2)):

%p seq(a(n), n=0..27); # _Alois P. Heinz_, May 23 2023

%p # third Maple program:

%p a:= proc(n) option remember; `if`(n<4, n*(n-1)/2+1,

%p n*(n-1)*a(n-2)/4 +a(n-1)/2)

%p end:

%p seq(a(n), n=0..27); # _Alois P. Heinz_, May 23 2023

%t a[n_] := Which[n<2, 1, EvenQ[n], 2(n/2)!^2, True, 2((n-1)/2)!*((n+1)/2)!];

%t Table[a[n], {n, 0, 27}] (* _Jean-François Alcover_, Aug 16 2023 *)

%Y Cf. A124419, A152874.

%K nonn,easy

%O 0,3

%A _Emeric Deutsch_, Dec 15 2008

%E a(0)=a(1)=1 prepended by _Alois P. Heinz_, May 23 2023

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 April 19 16:52 EDT 2024. Contains 371794 sequences. (Running on oeis4.)