Calculate n! for any positive integer with step-by-step solutions. Includes factorial tables, permutations, combinations, and scientific notation for large numbers.
Enter a number and click Calculate to see the factorial
The factorial function is one of the most fundamental concepts in mathematics, particularly in combinatorics, probability theory, and algebra. Our Factorial Calculator provides exact calculations with step-by-step solutions, making it perfect for students, teachers, and professionals working with permutations and combinations.
A factorial, written as n!, is the product of all positive integers from 1 to n. For example: 5! = 5 × 4 × 3 × 2 × 1 = 120. The special case 0! is defined as 1 by convention, which ensures mathematical formulas work consistently across all non-negative integers.
Factorials grow at an astonishing rate - faster than exponential functions. While 10! is about 3.6 million, 20! exceeds 2.4 quintillion, and 100! has 158 digits! Our calculator uses arbitrary precision arithmetic to handle factorials up to 10,000!, displaying results in scientific notation when they become too large for standard display.
Factorials are essential for counting arrangements and selections:
For large n, computing exact factorials becomes computationally expensive. Stirling's approximation provides an excellent estimate: n! ≈ √(2πn) × (n/e)^n. This formula becomes increasingly accurate as n grows and is widely used in statistical mechanics, information theory, and asymptotic analysis.
The definition 0! = 1 often confuses students, but it's crucial for mathematical consistency. Consider the pattern: 5! = 5 × 4!, 4! = 4 × 3!, 3! = 3 × 2!, 2! = 2 × 1!, and 1! = 1 × 0!. For this pattern to hold, 0! must equal 1. Additionally, there is exactly one way to arrange zero objects (by doing nothing), supporting this definition. This makes formulas like the binomial coefficient work correctly: C(n,0) = n!/(0!×n!) = 1, representing the one way to choose nothing.
Computing large factorials presents unique challenges. Standard 64-bit integers can only store up to 20! before overflow. Our calculator uses arbitrary precision arithmetic (bigint) to compute factorials far beyond this limit. For example, 100! has 158 digits, 1000! has 2568 digits, and 10000! has over 35,000 digits! We display these in scientific notation for practicality.
Factorial Number System: Also called factoradic, this mixed radix system uses factorials as place values. A number in factorial base uses digits d_n...d_2d_1d_0 where each d_i ranges from 0 to i. This system has applications in permutation generation and combinatorial algorithms. For example, 463 in decimal equals 341010 in factorial base.
Factorials are fundamental in calculating probabilities. The probability of a specific arrangement of n distinct items is 1/n!. In lottery games, the odds of choosing k numbers from n numbers is 1/C(n,k) = (k!×(n-k)!)/n!. Understanding factorials helps quantify just how unlikely certain events are - for instance, two identical shuffles of a 52-card deck are virtually impossible given that there are 52! ≈ 8×10^67 possible arrangements.
The double factorial n!! multiplies every other number: 9!! = 9×7×5×3×1 = 945 and 8!! = 8×6×4×2 = 384. Similarly, triple factorials (n!!!) and higher exist. These have applications in combinatorics and physics. The falling factorial (n)_k = n×(n-1)×...×(n-k+1) and rising factorial n^(k) are related concepts used in discrete mathematics and special function theory.
While factorials are defined only for non-negative integers, the Gamma function Γ(z) extends this concept to real and complex numbers. For positive integers n, Γ(n+1) = n!. This allows "factorial-like" calculations for non-integer values: Γ(1/2) = √π, Γ(3/2) = √π/2. The Gamma function appears in advanced probability distributions, quantum mechanics, and mathematical analysis.
Factorials appear in the denominators of Taylor series expansions. For example, e^x = Σ(x^n/n!) and sin(x) = Σ((-1)^n × x^(2n+1)/(2n+1)!). These infinite series converge because factorial growth in denominators overwhelms polynomial growth in numerators. This makes factorials essential for approximating transcendental functions and understanding convergence in analysis.
In computer science, O(n!) represents factorial time complexity - the worst possible for practical algorithms. The traveling salesman problem, where you must find the shortest route visiting n cities, has n!/2 possible routes to check in the brute-force approach. For just 20 cities, that's over 1.2×10^18 routes! This impracticality drives the development of approximation algorithms and heuristics for NP-complete problems.
The factorial notation n! was introduced by Christian Kramp in 1808, though the concept existed much earlier. Ancient Indian mathematicians studied permutations and combinations as early as the 6th century BCE. The study of factorials expanded significantly with the development of probability theory in the 17th century by mathematicians like Pascal and Fermat, and continues to be fundamental in modern mathematics and computer science.
Problem 1: In how many ways can 5 books be arranged on a shelf?
Solution: 5! = 120 ways
Problem 2: How many 3-letter words can be formed from the letters A, B, C, D, E (without repetition)?
Solution: P(5,3) = 5!/(5-3)! = 120/2 = 60 words
Problem 3: How many ways can you choose 3 people from a group of 10 for a committee?
Solution: C(10,3) = 10!/(3!×7!) = 3628800/(6×5040) = 120 ways
Problem 4: What's the probability of getting a specific 5-card poker hand?
Solution: 1/C(52,5) = 1/(52!/(5!×47!)) ≈ 1/2,598,960 or about 0.0000385%
“Perfect tool for teaching combinatorics! The step-by-step breakdown helps students understand how factorials work, and the permutations/combinations examples make abstract concepts concrete. The ability to handle large numbers is impressive!”
“Needed this for algorithm analysis homework. Being able to see factorial growth patterns and get exact values (not just approximations) saved me hours. The export feature is great for including calculations in my reports.”
“Use this regularly for probability calculations and statistical work. The Stirling's approximation comparison is useful, and I appreciate that it handles large factorials without overflow errors. Clean interface, accurate results!”
Love using our calculator?