What is Factorial?

Factorial is a mathematical operation that multiplies all positive integers from 1 to n.

Mathematical definition:

  • n! = n × (n-1) × (n-2) × ... × 2 × 1
  • Special case: 0! = 1

Factorials are widely used in permutations, combinations, probability theory, and Taylor series expansions.

Syntax

n! // Calculate n factorial
factorial(n) // Alternative function notation

Examples

Example 1: Calculate 5!
Input: 5!
Result: 120
5! = 5 × 4 × 3 × 2 × 1 = 120
Example 2: Calculate 10!
Input: 10!
Result: 3,628,800
Example 3: Calculate 0!
Input: 0!
Result: 1
By mathematical definition, 0! = 1
Example 4: Combination calculation
Input: 5! / (2! * 3!)
Result: 10
Calculate C(5,3) - combinations of 5 items taken 3 at a time
Example 5: Factorial arithmetic
Input: 3! + 4!
Result: 30
3! + 4! = 6 + 24 = 30

Common Factorial Values

n n!
01
11
22
36
424
5120
6720
75,040
840,320
9362,880
103,628,800

Important Notes

  1. Factorial is only defined for non-negative integers
  2. Negative number factorials are undefined in real numbers
  3. Factorials grow very fast - 20! exceeds 2×10¹⁸
  4. Large factorials may cause calculator overflow