Factorial Calculator

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.

star 4.7

Factorial Calculator calculator

exclamation Factorial Calculator
About This Mode
Factorial (n!): Product of all positive integers from 1 to n. Example: 5! = 5×4×3×2×1 = 120
calculate Result
Expression
5!
Result
120
Step-by-Step
5! = 5 × 4 × 3 × 2 × 1
= 120
Formulas
n! = n × (n-1) × ... × 1
nPr = n! / (n-r)!
nCr = n! / [r!(n-r)!]

lightbulb Tips

  • 0! = 1 by definition
  • nPr = n!/(n-r)!
  • nCr = n!/[r!(n-r)!]
  • Max: 170! (float limit)

exclamation Reference

Common Factorials
0! = 16! = 720 1! = 17! = 5,040 2! = 28! = 40,320 3! = 69! = 362,880 4! = 2410! = 3,628,800 5! = 12020! = 2.4×10¹⁸
Key Formulas
n! = n × (n-1)!
nPr = n!/(n-r)!
nCr = n!/[r!(n-r)!]

How to Use the Factorial Calculator

calculate

Select Calculation

Choose factorial, permutation, combination, or other types.

edit

Enter n Value

Input the number for factorial calculation (0-170).

input

Enter r (if needed)

For permutations/combinations, enter the r value.

visibility

View Results

See the result with step-by-step calculation.

The Formula

Factorial multiplies all positive integers up to n. It's used in probability, combinatorics, and calculus.

n! = n × (n-1) × (n-2) × ... × 2 × 1

lightbulb Variables Explained

  • n! Factorial of n
  • nPr Permutations: n!/(n-r)!
  • nCr Combinations: n!/[r!(n-r)!]

tips_and_updates Pro Tips

1

0! = 1 by definition - this is essential for many mathematical formulas

2

Factorials grow extremely fast: 10! = 3,628,800 and 20! has 19 digits

3

For permutations (order matters): nPr = n!/(n-r)!

4

For combinations (order doesn't matter): nCr = n!/[r!(n-r)!]

5

Double factorial n!! multiplies every other number: 7!! = 7×5×3×1 = 105

6

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.

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.

Permutations vs Combinations

Permutations count arrangements where order matters (nPr). Combinations count selections where order doesn't matter (nCr).

Use permutations for rankings, combinations for groups.

How Do You Calculate a Factorial Step by Step?

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.

What Is the Factorial Formula and Recursive Definition?

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:

  • permutations nPr = n!/(n−r)!
  • combinations nCr = n!/[r!(n−r)!]

These three expressions cover most counting problems you will meet in probability and discrete math.

Why Does 0! Equal 1?

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.

How Fast Do Factorials Grow?

Factorials grow faster than any exponential function, which is why manual computation becomes impractical quickly. To illustrate:

  • 5! = 120
  • 10! = 3,628,800
  • 20! = 2,432,902,008,176,640,000 — already more than 2.4 quintillion

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.

What Is a Double Factorial (n!!) and How Do You Compute It?

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.

What Is a Subfactorial (!n) and Derangements?

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.

Where Are Factorials Used in Real Life?

Factorials underpin any problem that counts arrangements or selections.

  • In probability, the number of distinct 5-card poker hands from a 52-card deck is the combination 52C5 = 2,598,960.
  • In scheduling and logistics, n! gives the number of orderings for n tasks or stops.
  • In calculus, factorials sit in the denominators of Taylor and Maclaurin series, controlling how fast terms shrink so functions like e^x and sin x can be approximated.

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.

Common Mistakes When Working With Factorials

Several errors trip people up when working with factorials:

  • The most frequent error is forgetting that 0! = 1, which breaks combination and permutation formulas at their edges.
  • Another is confusing the double factorial n!! (every other integer) with applying factorial twice — 5!! = 15, but (5!)! is astronomically larger.
  • Students also mix up permutations and combinations: use nPr when order matters and nCr when it does not, so 5P2 = 20 but 5C2 = 10.
  • Watch for negative or non-integer inputs, since the elementary factorial is undefined there (only the gamma function extends it).
  • Finally, remember that factorials overflow quickly — beyond about 170! most calculators lose precision, as Wolfram MathWorld's growth analysis makes clear.

How Do Permutations and Combinations Use 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.

Frequently Asked Questions

sell

Tags