Search for a tool
Factorial

Tool for computing factorials. Factorial n! is the product of all integer numbers (not zero) inferior or equal to n, it is symbolized by an exclamation point juxtaposed after the number.

Results

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 'Factorial' tool for free! Thank you!

Factorial

Factorial Calculator N!


Gamma Calculator Γ(N)




Answers to Questions (FAQ)

What is a factorial? (Definition)

Factorial of a number $ n $ is the product of the positive integers numbers (not null) less or equal to $ n $.

The usual notation to indicate a factorial is the exclamation mark positioned after the number. The factorial of $ n $ is noted $ n! $.

How to calculate a factorial?

Factorial is calculated with a multiplication

$$ n!=\prod_{k=1}^n k = 1 \times 2 \times 3 \times \cdots \times n $$

Example: $$ 4! = 1 \times 2 \times 3 \times 4 = 24 $$

Example: The number of ways to sort a set of 52 cards is worth $ 52! = 1 \times 2 \times \dots \times 51 \times 52 = \\ 806581751709438785716606368564037\\66975289505440883277824000000000000 \\ \approx 8.0658 \times 10^{67} $$

Note that the factorial of zero is equal to one: $ 0! = 1 $

Example: Here are the values of the first factorials $$ 0! = 1 \\ 1! = 1 \\ 2! = 2 \\ 3! = 6 \\ 4! = 24 \\ 5! = 120 \\ 6! = 720 \\ 7! = 5040 \\ 8! = 40320 \\ 9! = 362880 \\ 10! = 3628800 $$

What is the Gamma Function?

Euler-Gamma is an extension of the factorial function over the complex numbers set.

$$ \Gamma(n+1) = \int_0^{+\infty} t^n \exp(-t) \rm{d}t $$

and the formula that links gamma to the factorial:

$$ \forall\,n \in \mathbb{N}, \; \Gamma(n+1)=n! $$

How to calculate a negative factorial?

For computing the factorial equivalent of negative numbers, use the Gamma function.

How to calculate a factorial for a decimal number?

Pour computing the factorial equivalent of fraction or decimal numbers, use the Gamma function.

What is the algorithm of the factorial function?

The factorial algorithm with a loop:function fact(n) {
f = 1
if (n >= 2) {
for (i = 2 ; i < n; i++) {
f = f * i
}
}
return f
}

The recursive factorial algorithm: function fact(n) {
if (n <= 1)
return 1
else
return fact(n-1)*n
}

How to quickly compute a factorial value?

For large numbers, it is possible to estimate the value of $ n! $ with a good precision using the Stirling formula. $$ n!\sim\sqrt{2\pi n}\left(\frac{n}{e}\right)^n $$

How to calculate the product of consecutive integers?

To calculate the product of numbers between $ n $ and $ n + m $, use factorials:

$$ \prod_{i=0}^m (n+i) = n(n+1)(n+2)\cdots(n+m) = \frac{(n+m)!}{(n-1)!} $$

Source code

dCode retains ownership of the "Factorial" source code. Any algorithm for the "Factorial" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "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 "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 "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/factorial
In a scientific article or book, the recommended bibliographic citation is: Factorial on dCode.fr [online website], retrieved on 2025-04-15, https://www.dcode.fr/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 'Factorial' tool for free! Thank you!


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