Calculate the factorial of any non-negative integer n (n!) with a detailed step-by-step breakdown showing each multiplication step. Perfect for combinatorics, permutations, and math studies.
5! = 5 × 4 × 3 × 2 × 1 = 120
This is one of the most common introductory factorial examples. Start with 5, multiply by each integer down to 1.
By definition, 0! = 1
The factorial of zero is defined as 1. This might seem counterintuitive, but it's essential for formulas in combinatorics (like choosing 0 items from a set) and makes many mathematical formulas work correctly.
You have 7 different books to arrange on a shelf. How many possible arrangements are there?
Solution: 7! = 7 × 6 × 5 × 4 × 3 × 2 × 1 = 5,040
There are 5,040 different ways to arrange 7 books on a shelf. This is a classic permutations problem.
From a group of 10 people, how many ways can you choose a committee of 3?
Solution: This uses the combination formula: C(10,3) = 10! / (3! × 7!)
10! = 3,628,800, 3! = 6, 7! = 5,040 → C(10,3) = 3,628,800 / (6 × 5,040) = 120
There are 120 possible committees of 3 people from a group of 10.
The factorial of a non-negative integer n, denoted as n!, is the product of all positive integers less than or equal to n. Factorials are defined mathematically as:
Factorials can also be defined recursively, which is helpful in computer programming:
Factorials grow extremely quickly. Even relatively small inputs produce enormous results. For example, 10! = 3,628,800, but 20! = 2,432,902,008,176,640,000 (about 2.4 quintillion). The maximum n our calculator handles is 170, which produces a 309-digit number. This limit is due to JavaScript's BigInt precision constraints on very large numbers.
A factorial is a mathematical operation that multiplies a given non-negative integer n by every positive integer less than it, down to 1. Denoted by an exclamation mark (n!), it's one of the most fundamental concepts in combinatorics, probability theory, and many areas of higher mathematics.
The factorial function grows at an astonishing rate — much faster than exponential functions. While 10! is already 3,628,800 (3.6 million), 20! is over 2.4 quintillion, and 170! produces a number with 309 digits. This rapid growth makes factorials essential in fields like statistics, physics, and computer science where large combinatorial calculations are common.
The factorial operation is deeply connected to the Gamma function, which extends the factorial concept to real and complex numbers. For positive integers, Γ(n+1) = n!, making the Gamma function the continuous analogue of the discrete factorial.
The definition of 0! = 1 might seem arbitrary at first, but it's necessary for consistency. Consider that n! = n × (n-1)!. If we set n = 1, we get 1! = 1 × 0!, so 0! must equal 1 for the formula to work. Additionally, in combinatorics, the number of ways to choose all n items from a set of n items — or to choose nothing (0 items) — is exactly 1, making 0! = 1 the natural definition.
Factorials appear throughout mathematics and its applications. Understanding them is essential for many areas of study and practical problem-solving.
The number of ways to arrange n distinct items in a sequence is n!. For example, 5 books can be arranged in 5! = 120 different orders on a shelf.
The number of ways to choose k items from a set of n items is C(n,k) = n! / (k! × (n-k)!). This formula is the foundation of the binomial theorem and probability calculations.
Factorials appear in probability distributions like the Poisson distribution, in calculating expected values, and in the fundamental counting principle.
Factorials appear in Taylor series expansions, where functions like e^x are expressed as infinite sums involving factorials in the denominators.
function factorial(n) { let result = 1n; for (let i = 2n; i <= n; i++) result *= i; return result; } using BigInt for large numbers. Other languages have similar approaches, and many provide built-in factorial functions in their standard math libraries.
⚠️ Educational Use Notice: This Factorial Calculator is designed for educational and reference purposes. Results are accurate for the supported range (0-170). For extremely large factorials beyond 170!, specialized mathematical software is recommended. Always verify critical calculations independently.