%I M0876 #144 Dec 16 2023 17:09:42
%S 1,1,2,3,8,15,48,105,384,945,3840,10395,46080,135135,645120,2027025,
%T 10321920,34459425,185794560,654729075,3715891200,13749310575,
%U 81749606400,316234143225,1961990553600,7905853580625,51011754393600,213458046676875,1428329123020800
%N Double factorials n!!: a(n) = n*a(n-2) for n > 1, a(0) = a(1) = 1.
%C Product of pairs of successive terms gives factorials in increasing order. - _Amarnath Murthy_, Oct 17 2002
%C a(n) = number of down-up permutations on [n+1] for which the entries in the even positions are increasing. For example, a(3)=3 counts 2143, 3142, 4132. Also, a(n) = number of down-up permutations on [n+2] for which the entries in the odd positions are decreasing. For example, a(3)=3 counts 51423, 52413, 53412. - _David Callan_, Nov 29 2007
%C The double factorial of a positive integer n is the product of the positive integers <= n that have the same parity as n. - _Peter Luschny_, Jun 23 2011
%C For n even, a(n) is the number of ways to place n points on an n X n grid with pairwise distinct abscissa, pairwise distinct ordinate, and 180-degree rotational symmetry. For n odd, the number of ways is a(n-1) because the center point can be considered "fixed". For 90-degree rotational symmetry cf. A001813, for mirror symmetry see A000085, A135401, and A297708. - _Manfred Scheucher_, Dec 29 2017
%C Could be extended to include a(-1) = 1. But a(-2) is not defined, otherwise we would have 1 = a(0) = 0*a(-2). - _Jianing Song_, Oct 23 2019
%D Putnam Contest, 4 Dec. 2004, Problem A3.
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H Indranil Ghosh, <a href="/A006882/b006882.txt">Table of n, a(n) for n = 0..806</a> (terms 0..100 from T. D. Noe)
%H Christian Aebi and Grant Cairns, <a href="http://www.jstor.org/stable/10.4169/amer.math.monthly.122.5.433">Generalizations of Wilson's Theorem for Double-, Hyper-, Sub-and Superfactorials</a>, The American Mathematical Monthly 122.5 (2015): 433-443.
%H CombOS - Combinatorial Object Server, <a href="http://combos.org/cperm">Generate colored permutations</a>
%H Joseph E. Cooper III, <a href="http://arxiv.org/abs/1510.00399">A recurrence for an expression involving double factorials</a>, arXiv:1510.00399 [math.CO], 2015.
%H Gary T. Leavens and Mike Vermeulen, <a href="/A006877/a006877_1.pdf">3x+1 search programs</a>, Computers and Mathematics with Applications, 24 (1992), 79-99. (Annotated scanned copy)
%H Peter Luschny, <a href="http://oeis.org/wiki/User:Peter_Luschny/Multifactorials">Multifactorials</a>
%H B. E. Meserve, <a href="http://www.jstor.org/stable/2306136">Double Factorials</a>, American Mathematical Monthly, 55 (1948), 425-426.
%H Rudolph Ondrejka, <a href="http://dx.doi.org/10.1090/S0025-5718-70-99856-X">Tables of double factorials</a>, Math. Comp., Vol. 24, No. 109 (1970), p. 231.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/DoubleFactorial.html">Double Factorial</a>.
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Multifactorial.html">Multifactorial</a>.
%H <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>
%H <a href="/index/Cor#core">Index entries for "core" sequences</a>
%F a(n) = Product_{i=0..floor((n-1)/2)} (n - 2*i).
%F E.g.f.: 1+exp(x^2/2)*x*(1+sqrt(Pi/2)*erf(x/sqrt(2))). - _Wouter Meeussen_, Mar 08 2001
%F Satisfies a(n+3)*a(n) - a(n+1)*a(n+2) = (n+1)!. [Putnam Contest]
%F a(n) = n!/a(n-1). - _Vaclav Kotesovec_, Sep 17 2012
%F a(n) * a(n+3) = a(n+1) * (a(n+2) + a(n)). a(n) * a(n+1) = (n+1)!. - _Michael Somos_, Dec 29 2012
%F a(n) ~ c * n^((n+1)/2) / exp(n/2), where c = sqrt(Pi) if n is even, and c = sqrt(2) if n is odd. - _Vaclav Kotesovec_, Nov 08 2014
%F a(2*n) = 2^n*a(n)*a(n-1). a(2^n) = 2^(2^n - 1) * 1!! * 3!! * 7!! * ... * (2^(n-1) - 1)!!. - _Peter Bala_, Nov 01 2016
%F a(n) = 2^h*(2/Pi)^(sin(Pi*h)^2/2)*Gamma(h+1) where h = n/2. This analytical extension supports the view that a(-1) = 1 is a meaningful numerical extension. With this definition (-1/2)!! = Gamma(3/4)/Pi^(1/4). - _Peter Luschny_, Oct 24 2019
%F a(n) ~ (n+1/6)*sqrt((2/e)*(n/e)^(n-1)*(Pi/2)^(cos(n*Pi/2)^2)). - _Peter Luschny_, Oct 25 2019
%F Sum_{n>=0} 1/a(n) = A143280. - _Amiram Eldar_, Nov 10 2020
%F Sum_{n>=0} 1/(a(n)*a(n+1)) = e - 1. - _Andrés Ventas_, Apr 12 2021
%e G.f. = 1 + x + 2*x^2 + 3*x^3 + 8*x^4 + 15*x^5 + 48*x^6 + 105*x^7 + 384*x^8 + ...
%p A006882 := proc(n) option remember; if n <= 1 then 1 else n*A006882(n-2); fi; end;
%p A006882 := proc(n) doublefactorial(n) ; end proc; seq(A006882(n),n=0..10) ; # _R. J. Mathar_, Oct 20 2009
%p A006882 := n -> mul(k, k = select(k -> k mod 2 = n mod 2, [$1 .. n])): seq(A006882(n), n = 0 .. 10); # _Peter Luschny_, Jun 23 2011
%p A006882 := proc(n) if n=0 then 1 else mul(n-2*k, k=0..floor(n/2)-1); fi; end; # _N. J. A. Sloane_, May 27 2016
%t Array[ #!!&, 40, 0 ]
%t multiFactorial[n_, k_] := If[n < 1, 1, If[n < k + 1, n, n*multiFactorial[n - k, k]]]; Array[ multiFactorial[#, 2] &, 27, 0] (* _Robert G. Wilson v_, Apr 23 2011 *)
%o (PARI) {a(n) = prod(i=0, (n-1)\2, n - 2*i )} \\ Improved by _M. F. Hasler_, Nov 30 2013
%o (PARI) {a(n) = if( n<2, n>=0, n * a(n-2))}; /* _Michael Somos_, Apr 06 2003 */
%o (PARI) {a(n) = if( n<0, 0, my(E); E = exp(x^2 / 2 + x * O(x^n)); n! * polcoeff( 1 + E * x * (1 + intformal(1 / E)), n))}; /* _Michael Somos_, Apr 06 2003 */
%o (Magma) DoubleFactorial:=func< n | &*[n..2 by -2] >; [ DoubleFactorial(n): n in [0..28] ]; // _Klaus Brockhaus_, Jan 23 2011
%o (Haskell)
%o a006882 n = a006882_list !! n
%o a006882_list = 1 : 1 : zipWith (*) [2..] a006882_list
%o -- _Reinhard Zumkeller_, Oct 23 2014
%o (Python)
%o from sympy import factorial2
%o def A006882(n): return factorial2(n) # _Chai Wah Wu_, Apr 03 2021
%Y Bisections are A000165 and A001147. These two entries have more information.
%Y Cf. A052319, A143280.
%Y A diagonal of A202212.
%Y Cf. A000085, A001813, A135401, A297708. - _Manfred Scheucher_, Jan 07 2018
%K nonn,easy,core,nice
%O 0,3
%A _Robert Munafo_