What is Factorial?
Factorial of n (written as n!) is the product of all positive integers up to n. For example, 5! = 5×4×3×2×1 = 120.
Factorials are fundamental in counting and probability.
Factorials grow extraordinarily fast — 20! already exceeds 2 quintillion — making manual computation impractical. This calculator handles large factorials precisely, supports double factorials (n!!), and bridges directly into combinatorics through built-in permutation (nPr) and combination (nCr) functions. Common applications include counting arrangements of objects, calculating probability distributions in statistics, evaluating Taylor series expansions in calculus, and solving problems in quantum mechanics and number theory.
Choose factorial, permutation, combination, or other types.
Input the number for factorial calculation (0-170).
For permutations/combinations, enter the r value.
See the result with step-by-step calculation.
Factorial multiplies all positive integers up to n. It's used in probability, combinatorics, and calculus.
n! = n × (n-1) × (n-2) × ... × 2 × 1
0! = 1 by definition - this is essential for many mathematical formulas
Factorials grow extremely fast: 10! = 3,628,800 and 20! has 19 digits
For permutations (order matters): nPr = n!/(n-r)!
For combinations (order doesn't matter): nCr = n!/[r!(n-r)!]
Double factorial n!! multiplies every other number: 7!! = 7×5×3×1 = 105
Calculators typically support up to 170! due to floating-point limits
Calculate factorials (n!), double factorials (n!!), permutations (nPr), and combinations (nCr) with step-by-step solutions. Essential for probability and statistics.
Factorial of n (written as n!) is the product of all positive integers up to n. For example, 5! = 5×4×3×2×1 = 120.
Factorials are fundamental in counting and probability.
Permutations count arrangements where order matters (nPr). Combinations count selections where order doesn't matter (nCr).
Use permutations for rankings, combinations for groups.
To calculate a factorial n!, multiply every positive integer from 1 up to n together. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120, and 6! = 6 × 120 = 720.
The quickest hand method uses the recursive rule n! = n × (n−1)!, so each new factorial is just the previous result times the next integer. This calculator applies that recursion internally, then displays each multiplication as a step.
As Wolfram MathWorld notes, the factorial is defined for all non-negative integers, and 0! is fixed at 1 to keep the recursion consistent.
The factorial formula is n! = n × (n−1) × (n−2) × … × 2 × 1, with the base case 0! = 1. Equivalently, factorials satisfy the recurrence n! = n × (n−1)!, which lets you build each value from the one before.
The NIST Digital Library of Mathematical Functions extends this idea beyond integers through the gamma function, where n! = Γ(n+1).
For combinatorics you also use two derived formulas:
These three expressions cover most counting problems you will meet in probability and discrete math.
0! equals 1 by definition, and it is not an arbitrary choice. There is exactly one way to arrange an empty set of objects — do nothing — so the count of arrangements is one.
Setting 0! = 1 also keeps the recursion n! = n × (n−1)! valid, since 1! = 1 × 0! only works if 0! = 1. It further makes formulas like nCr = n!/[r!(n−r)!] return the correct answer when r = 0 or r = n.
Khan Academy and Encyclopaedia Britannica both present 0! = 1 as the standard convention underlying combinatorics and the binomial theorem.
Factorials grow faster than any exponential function, which is why manual computation becomes impractical quickly. To illustrate:
By 170! the value is roughly 7.26 × 10^306, near the limit of standard double-precision floating point, which is why many tools cap input at 170.
This super-exponential growth (formally n! grows like Stirling's approximation √(2πn)(n/e)^n, described in the NIST DLMF) explains why factorials appear in the denominators of Taylor series, where they shrink terms fast enough for the series to converge.
A double factorial n!! multiplies every other integer down from n, stopping at 1 (odd n) or 2 (even n). For odd numbers, 7!! = 7 × 5 × 3 × 1 = 105; for even numbers, 8!! = 8 × 6 × 4 × 2 = 384.
It is not the same as taking a factorial twice — (n!)! would be enormous by comparison. Double factorials appear in integrals of powers of sine and cosine and in formulas for the volume of high-dimensional spheres.
Wolfram MathWorld catalogs the double factorial as its own function, and OEIS lists the odd double factorials 1, 3, 15, 105, 945 as sequence A001147.
A subfactorial !n counts derangements — permutations in which no element stays in its original position. For three items {1, 2, 3}, only {2, 3, 1} and {3, 1, 2} qualify, so !3 = 2; likewise !4 = 9 and !5 = 44.
The subfactorial follows the formula !n = n! × Σ (−1)^k / k! for k = 0 to n, and it is closely tied to probability puzzles like the "hat-check" problem, where the chance nobody gets their own hat approaches 1/e ≈ 0.3679 as n grows.
OEIS records the derangement numbers 1, 0, 1, 2, 9, 44, 265 as sequence A000166.
Factorials underpin any problem that counts arrangements or selections.
They also appear in the binomial theorem, statistical distributions such as Poisson and binomial, and cryptography. Khan Academy uses these combinatorial counts as the foundation of its probability curriculum.
Several errors trip people up when working with factorials:
Both permutations and combinations are built directly from factorials.
A permutation nPr = n!/(n−r)! counts ordered arrangements, so choosing and ordering 2 of 5 items gives 5P2 = 5!/3! = 120/6 = 20.
A combination nCr = n!/[r!(n−r)!] counts unordered selections, so 5C2 = 5!/(2!·3!) = 120/(2×6) = 10 — exactly half of 5P2 because each pair can be ordered two ways. Combinations are also called binomial coefficients and generate Pascal's triangle. Because nC2 = n(n−1)/2 is quadratic in n, reversing the question — finding how many items produce a given number of pairs, as in the classic handshake problem — comes down to a quadratic equation solver.
Encyclopaedia Britannica describes these as the core operations of combinatorics, and this calculator computes nPr and nCr with full step-by-step working.
Data sourced from trusted institutions
All formulas verified against official standards.