FACTDOUBLE function
FACTDOUBLE(n) returns the double factorial of n.
The double factorial of a number
If n is even, the double factorial is
$$ n!! = \prod_{k=1}^\frac{n}{2} (2k) = n(n-2)(n-4)\cdots 4\cdot 2 $$
If n is odd, the double factorial is
$$ n!! = \prod_{k=1}^\frac{n+1}{2} (2k-1) = n(n-2)(n-4)\cdots 3\cdot 1 $$
For example, $ 9‼ {{=}} 9 × 7 × 5 × 3 × 1 {{=}} 945 $.
- If the argument n is not an integer, it is truncated.
- The argument n cannot be negative.
- If the even number n is larger than 300, or if the odd number n is larger than 263, the function overflows and returns an error.
- The argument n can be a real number or a matrix. When it is a matrix, the function returns a matrix with the same dimensions and with the FACTDOUBLE function applied to all elements.