Factorial Calculator

Calculate factorials with step-by-step solutions, scientific notation for large values, and applications in permutations and combinations.

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

Result

Factorial

120

n!
Input5
Digits3

Calculate Factorial

Enter a non-negative integer (0-170)

5! = 120

(3 digits)

Step-by-Step Solution

1

Formula: n! = n x (n-1) x (n-2) x ... x 2 x 1

2

Special case: 0! = 1 (by definition)

3

5! = 5 x 4 x 3 x 2 x 1

4

5 x 4 = 20

5

20 x 3 = 60

6

60 x 2 = 120

7

120 x 1 = 120

8

Result: 5! = 120

Double Factorial

5!! = 15

5 x 3 x ... = 15

Subfactorial (Derangements)

!5 = 44

Number of permutations with no fixed points

Stirling's Approximation

118

Error: 1.6507%

Result

Factorial

120

n!
Input5
Digits3

?How Do You Calculate a Factorial?

Factorial of n (written n!) is the product of all positive integers from 1 to n: n! = n x (n-1) x (n-2) x ... x 2 x 1. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120. Special case: 0! = 1 by definition. Factorials grow extremely fast and are used in permutations, combinations, probability, and Taylor series.

What is a Factorial?

The factorial of a non-negative integer n, denoted n!, is the product of all positive integers less than or equal to n. Factorials are fundamental in combinatorics for counting permutations and combinations, in probability theory, in calculus for Taylor series expansions, and in many areas of mathematics and science. The factorial function grows faster than exponential functions.

Key Facts About Factorials

  • n! = n x (n-1) x (n-2) x ... x 2 x 1
  • 5! = 5 x 4 x 3 x 2 x 1 = 120
  • 0! = 1 (by definition)
  • Factorials grow very fast: 10! = 3,628,800
  • Used in permutations: P(n,r) = n!/(n-r)!
  • Used in combinations: C(n,r) = n!/(r!(n-r)!)
  • 20! has 19 digits, 100! has 158 digits
  • Stirling approximation: n! is approximately sqrt(2 x pi x n)(n/e)^n

Try These Factorial Examples

Quick-start with common scenarios

Practice Mode

Test your skills with practice problems

Practice with 5 problems to test your understanding.

Frequently Asked Questions

The factorial of n (written n!) is the product of all positive integers from 1 to n. For example, 5! = 5 x 4 x 3 x 2 x 1 = 120. By convention, 0! = 1. Factorials count the number of ways to arrange n distinct objects.

There are two reasons: (1) Combinatorially, there is exactly one way to arrange zero objects - do nothing. (2) Mathematically, the recurrence n! = n x (n-1)! requires 0! = 1 for 1! = 1 x 0! to equal 1.

Factorials grow faster than any exponential function. 10! = 3,628,800 (7 digits), 20! = 2.4 x 10^18 (19 digits), 100! has 158 digits. By Stirling's approximation, n! is approximately sqrt(2*pi*n) x (n/e)^n.

The double factorial n!! multiplies every other number: n!! = n x (n-2) x (n-4) x ... down to 1 or 2. For example: 7!! = 7 x 5 x 3 x 1 = 105, and 8!! = 8 x 6 x 4 x 2 = 384.

The subfactorial !n counts derangements - permutations where no element is in its original position. For example, !3 = 2: the arrangements (2,3,1) and (3,1,2) are the only derangements of (1,2,3). Formula: !n = n! x sum of (-1)^k/k! from k=0 to n.

Last updated: 2025-01-15