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.
Factorial - dCode
Tag(s) : Arithmetics
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!
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! $.
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 $$
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! $$
For computing the factorial equivalent of negative numbers, use the Gamma function.
Pour computing the factorial equivalent of fraction or decimal numbers, use the Gamma 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
}
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 $$
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)!} $$
dCode retains ownership of the "Factorial" source code. Except explicit open source licence (indicated Creative Commons / free), the "Factorial" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Factorial" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Factorial" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.
The copy-paste of the page "Factorial" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Factorial on dCode.fr [online website], retrieved on 2024-12-21,