Math Calculators

Factorial Calculator

Free factorial calculator supporting n!, double factorial (n!!), subfactorial (!n), and gamma function. Calculate large factorials with step-by-step solutions.

Common Factorial Values

0!
1
1!
1
2!
2
3!
6
4!
24
5!
120
6!
720
7!
5,040
8!
40,320
9!
362,880
10!
3,628,800
12!
479,001,600

Reference

Factorial (n!): Product of all positive integers up to n.
n! = n × (n-1) × (n-2) × ... × 1
Double Factorial (n!!): Product of integers with same parity.
n!! = n × (n-2) × (n-4) × ...
Subfactorial (!n): Number of derangements (permutations with no fixed points).
!n = n! × Σ(-1)^k/k! for k=0 to n
Gamma Function Γ(n): Extension of factorial to real numbers.
Γ(n) = (n-1)! for positive integers

How to Use the Factorial Calculator

This calculator computes factorials and related functions including double factorial, subfactorial (derangements), and the gamma function.


Factorial (n!)

The factorial of n is the product of all positive integers from 1 to n.

Definition: n! = n × (n-1) × (n-2) × … × 2 × 1

Special cases:

  • 0! = 1 (by convention)
  • 1! = 1

Common Factorial Values

nn!
01
11
22
36
424
5120
6720
75,040
840,320
9362,880
103,628,800
12479,001,600
151,307,674,368,000
202,432,902,008,176,640,000

Applications

  • Counting arrangements (permutations)
  • Binomial coefficients
  • Probability distributions
  • Taylor series

Double Factorial (n!!)

The double factorial multiplies every other integer from n down to 1 or 2.

Definition:

  • For odd n: n!! = n × (n-2) × (n-4) × … × 3 × 1
  • For even n: n!! = n × (n-2) × (n-4) × … × 4 × 2

Special cases:

  • 0!! = 1
  • 1!! = 1
  • (-1)!! = 1

Examples

nn!!Expansion
111
222
333 × 1
484 × 2
5155 × 3 × 1
6486 × 4 × 2
71057 × 5 × 3 × 1
83848 × 6 × 4 × 2
99459 × 7 × 5 × 3 × 1
103,84010 × 8 × 6 × 4 × 2

Relationship to Factorial

  • For even n: n!! = 2^(n/2) × (n/2)!
  • For odd n: n!! = n! / (n-1)!!

Subfactorial (!n) - Derangements

The subfactorial counts derangements: permutations where no element stays in its original position.

Definition: !n = n! × Σ((-1)^k / k!) for k = 0 to n

Recurrence: !n = (n-1) × (!(n-1) + !(n-2))

Examples

n!nProbability
01100%
100%
2150%
3233.3%
4937.5%
54436.7%
626536.8%
71,85436.8%
814,83336.8%
101,334,96136.8%

Note: As n increases, the probability of a derangement approaches 1/e ≈ 36.79%

Applications

  • Secret Santa problem
  • Hat check problem
  • Card shuffling analysis

Gamma Function Γ(n)

The gamma function extends the factorial to non-integer values.

Key property: Γ(n) = (n-1)! for positive integers

Relationship: Γ(n+1) = n × Γ(n)

Special Values

xΓ(x)
11
21
32
46
524
1/2√π ≈ 1.7725
3/2√π/2 ≈ 0.8862
-1/2-2√π ≈ -3.5449

Notable Formula

Γ(1/2) = √π

This means (−1/2)! = √π, extending factorials to half-integers!


Stirling’s Approximation

For large n, factorial can be approximated:

n! ≈ √(2πn) × (n/e)^n

nn!Stirling ApproxError
5120118.021.7%
103,628,8003,598,6960.8%
202.43 × 10^182.42 × 10^180.4%

Factorial Growth

Factorials grow extremely fast—faster than exponential!

nn!2^nn^n
5120323,125
103,628,8001,02410^10
202.43 × 10^181.05 × 10^610^26

Number of digits in n!: approximately n × log₁₀(n/e) + 0.5 × log₁₀(2πn)

  • 100! has 158 digits
  • 1000! has 2,568 digits

Advertisement

Want to learn the theory?

Our lessons explain the statistical concepts behind this calculator with clear examples.

Browse Lessons →