Search for a tool
Double Factorial

Tool for calculating the double factorial. The double factorial n!! is the product of non-zero positive integers less than or equal to n that have the same parity as n (even or odd).

Results

Double Factorial -

Tag(s) : Arithmetics

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Double Factorial' tool for free! Thank you!

Double Factorial

Double Factorial Calculator N!!


Answers to Questions (FAQ)

What is Double Factorial? (Definition)

The double factorial (also called semifactorial) of a number $ n $, often denoted $ n!! $, is a mathematical operation applied to a positive integer $ n $ which consists of the multiplication (the product) of all non-zero integers less than or equal to $ n $ which have the same parity as $ n $.

How to calculate a double factorial?

The formula for the double factorial is: $$ n!! = \prod_{k=0}^{\left\lceil\frac{n}{2}\right\rceil - 1} (n-2k) = n (n-2) (n-4) \cdots $$

If $ n $ is an even number (multiple of 2) then $ n!! $ is the multiplication of all multiples of $ 2 $ less or equal than $ n $ (and greater than $ 0 $)

If $ n $ is an odd number (not a multiple of 2) then $ n!! $ is the multiplication of all non-multiple numbers of $ 2 $ less or equal than $ n $ (and greater than $ 0 $).

Example: $$ 8!! = 2 \times 4 \times 6 \times 8 = 384 $$

Example: $$ 5!! = 1 \times 3 \times 5 = 15 $$

Be careful not to confuse the double factorial $ n!! $ with the factorial of factorial $ (n!)! $

What is the value of double factorial of 0?

By convention, the double factorial of zero is equal to 1: $ 0!! = 1 $

What are the first values of the double factorial function?

The values of the first double factorials: $$ 0!! = 1 \\ 1!! = 1 \\ 2!! = 2 \\ 3!! = 3 \\ 4!! = 8 \\ 5!! = 15 \\ 6!! = 48 \\ 7!! = 105 \\ 8!! = 384 \\ 9!! = 945 \\ 10!! = 3840 $$

What are the properties of double factorial?

The remarkable relations of the double factorial with the factorial are:

$$ n! = n!! (n-1)!! $$

$$ n!! = \frac{n!}{(n-1)!!} = \frac{(n+1)!}{(n+1)!!} $$

What is !!n? (left side exclamation marks)

When the two exclamation points are to the left of the number, it may be the subfactorial or the double subfactorial.

$$ !n = n!\sum_{k=0}^n \frac{(-1)^k}{k!} $$

$$ !!n= (-1)^{\left\lfloor \frac{n}{2}\right\rfloor }\,n!! \sum_{i=0}^{\left\lfloor \frac{n}{2} \right\rfloor} \frac{(-1)^i}{(n-2 i)!!} $$

What is the algorithm for programming the double factorial?

A non-recursive function to calculate the double factorial of a number N is: // Pseudo-code
function doubleFactorial(n) {
if (n == 0 OR n == 1) return 1
result = 1
for i from n down to 2 by 2 {
result = result * i
}
return result
}

Source code

dCode retains ownership of the "Double Factorial" source code. Any algorithm for the "Double Factorial" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Double Factorial" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Double Factorial" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.

Cite dCode

The content of the page "Double Factorial" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source. Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link: https://www.dcode.fr/double-factorial
In a scientific article or book, the recommended bibliographic citation is: Double Factorial on dCode.fr [online website], retrieved on 2025-04-16, https://www.dcode.fr/double-factorial

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Double Factorial' tool for free! Thank you!


https://www.dcode.fr/double-factorial
© 2025 dCode — The ultimate collection of tools for games, math, and puzzles.
 
Feedback