A056040 Swinging factorial, a(n) = 2^(n-(n mod 2))*Product_{k=1..n} k^((-1)^(k+1)).
1, 1, 2, 6, 6, 30, 20, 140, 70, 630, 252, 2772, 924, 12012, 3432, 51480, 12870, 218790, 48620, 923780, 184756, 3879876, 705432, 16224936, 2704156, 67603900, 10400600, 280816200, 40116600, 1163381400, 155117520, 4808643120, 601080390, 19835652870, 2333606220
Offset: 0
Keywords
Examples
a(10) = 10!/5!^2 = trinomial(10,[5,0,5]); a(11) = 11!/5!^2 = trinomial(11,[5,1,5]).
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..400
- Didier Guillet, On swinging factorials and the lonely runner conjecture (Text in French).
- Peter Luschny, Die schwingende Fakultät und Orbitalsysteme, August 2011.
- Peter Luschny, Orbitals.
- Peter Luschny, Swinging Factorial.
Crossrefs
Programs
-
Magma
[(Factorial(n)/(Factorial(Floor(n/2)))^2): n in [0..40]]; // Vincenzo Librandi, Sep 11 2011
-
Maple
SeriesCoeff := proc(s,n) series(s(w,n),w,n+2); convert(%,polynom); coeff(%,w,n) end; a1 := proc(n) local k; 2^(n-(n mod 2))*mul(k^((-1)^(k+1)),k=1..n) end: a2 := proc(n) option remember; `if`(n=0,1,n^irem(n,2)*(4/n)^irem(n+1,2)*a2(n-1)) end; a3 := n -> n!/iquo(n,2)!^2; g4 := z -> BesselI(0,2*z)*(1+z); a4 := n -> n!*SeriesCoeff(g4,n); g5 := z -> (1+z/(1-4*z^2))/sqrt(1-4*z^2); a5 := n -> SeriesCoeff(g5,n); g6 := (z,n) -> (1+z^2)^n+n*z*(1+z^2)^(n-1); a6 := n -> SeriesCoeff(g6,n); a7 := n -> combinat[multinomial](n,floor(n/2),n mod 2,floor(n/2)); h := n -> binomial(n,floor(n/2)); # A001405 a8 := n -> ilcm(h(n-1),h(n)); F := [a1, a2, a3, a4, a5, a6, a7, a8]; for a in F do seq(a(i), i=0..32) od;
-
Mathematica
f[n_] := 2^(n - Mod[n, 2])*Product[k^((-1)^(k + 1)), {k, n}]; Array[f, 33, 0] (* Robert G. Wilson v, Aug 02 2010 *) f[n_] := If[OddQ@n, n*Binomial[n - 1, (n - 1)/2], Binomial[n, n/2]]; Array[f, 33, 0] (* Robert G. Wilson v, Aug 10 2010 *) sf[n_] := With[{f = Floor[n/2]}, Pochhammer[f+1, n-f]/f!]; (* or, twice faster: *) sf[n_] := n!/Quotient[n, 2]!^2; Table[sf[n], {n, 0, 32}] (* Jean-François Alcover, Jul 26 2013, updated Feb 11 2015 *)
-
PARI
a(n)=n!/(n\2)!^2 \\ Charles R Greathouse IV, May 02 2011
-
Sage
def A056040(): r, n = 1, 0 while True: yield r n += 1 r *= 4/n if is_even(n) else n a = A056040(); [next(a) for i in range(36)] # Peter Luschny, Oct 24 2013
Formula
a(n) = n!/floor(n/2)!^2. [Essentially the original name.]
a(0) = 1, a(n) = n^(n mod 2)*(4/n)^(n+1 mod 2)*a(n-1) for n>=1.
E.g.f.: (1+x)*BesselI(0, 2*x). - Vladeta Jovovic, Jan 19 2004
O.g.f.: a(n) = SeriesCoeff_{n}((1+z/(1-4*z^2))/sqrt(1-4*z^2)).
P.g.f.: a(n) = PolyCoeff_{n}((1+z^2)^n+n*z*(1+z^2)^(n-1)).
a(2*n) = binomial(2*n,n); a(2*n+1) = (2*n+1)*binomial(2*n,n). Central terms of triangle A211226. - Peter Bala, Apr 10 2012
D-finite with recurrence: n*a(n) + (n-2)*a(n-1) + 4*(-2*n+3)*a(n-2) + 4*(-n+1)*a(n-3) + 16*(n-3)*a(n-4) = 0. - Alexander R. Povolotsky, Aug 17 2012
Sum_{n>=0} 1/a(n) = 4/3 + 8*Pi/(9*sqrt(3)). - Alexander R. Povolotsky, Aug 18 2012
E.g.f.: U(0) where U(k)= 1 + x/(1 - x/(x + (k+1)*(k+1)/U(k+1))); (continued fraction, 3-step). - Sergei N. Gladkovskii, Oct 19 2012
Central column of the coefficients of the swinging polynomials A162246. - Peter Luschny, Oct 22 2013
a(n) = hypergeometric([-n,-n-1,1/2],[-n-2,1],2)*2^(n-1)*(n+2). - Peter Luschny, Sep 22 2014
a(n) = 4^floor(n/2)*hypergeometric([-floor(n/2), (-1)^n/2], [1], 1). - Peter Luschny, May 19 2015
Sum_{n>=0} (-1)^n/a(n) = 4/3 - 4*Pi/(9*sqrt(3)). - Amiram Eldar, Mar 10 2022
Extensions
Extended and edited by Peter Luschny, Jun 28 2009
Comments