Factorial Calculator

Calculate n! for any positive integer with step-by-step solutions. Includes factorial tables, permutations, combinations, and scientific notation for large numbers.

Exact
Calculation
Step-by-Step
Solutions
Large Number
Support
Applications
Examples

Calculate Factorial

Calculate n! (n factorial)

Factorial Table (1! - 20!)

1! = 1
11! = 39,916,800
2! = 2
12! = 479,001,600
3! = 6
13! = 6,227,020,800
4! = 24
14! = 87,178,291,200
5! = 120
15! = 1.31 × 10^12
6! = 720
16! = 2.09 × 10^13
7! = 5,040
17! = 3.56 × 10^14
8! = 40,320
18! = 6.40 × 10^15
9! = 362,880
19! = 1.22 × 10^17
10! = 3,628,800
20! = 2.43 × 10^18

Enter a number and click Calculate to see the factorial

Factorial Values (1! - 10!)

Factorial Growth Pattern

Understanding Factorials

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.

What is a Factorial?

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.

Factorial Growth and Large Numbers

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.

Applications in Permutations and Combinations

Factorials are essential for counting arrangements and selections:

  • Permutations: P(n,r) = n!/(n-r)! counts ordered arrangements
  • Combinations: C(n,r) = n!/(r!×(n-r)!) counts unordered selections
  • Probability: Calculating odds in games, lotteries, and random events
  • Series Expansions: Taylor and Maclaurin series use factorials in denominators
  • Algorithm Analysis: Analyzing complexity of sorting and arrangement algorithms

Stirling's Approximation

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.

Real-World Examples

  • Seating Arrangements: 8 people at a dinner table can be seated in 8! = 40,320 ways
  • Card Games: A deck of 52 cards can be shuffled into 52! ≈ 8×10^67 different orders
  • Tournament Brackets: n teams can finish in n! possible rank orders
  • Password Combinations: Calculating possible arrangements of characters
  • Manufacturing: Scheduling n jobs in different orders for optimization

Why 0! = 1

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.

Computational Challenges with Large Factorials

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 in Different Number Systems

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 in Probability Theory

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.

Double Factorials and Multifactorials

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.

The Gamma Function Extension

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 in Series and Calculus

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.

Algorithm Time Complexity

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.

Historical Context

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.

Practical Tips for Using This Calculator

  1. 1. Understand the growth: Factorials increase incredibly fast; even 25! is over 15 quadrillion
  2. 2. Use permutations for order-sensitive problems: Arranging books, seating people, creating passwords
  3. 3. Use combinations for order-independent selections: Lottery picks, committee selection, card hands
  4. 4. Remember 0! = 1: This is defined mathematically, not a computational error
  5. 5. Check reasonableness: If calculating C(50,3), verify it's much less than 50!
  6. 6. Use Stirling's approximation for estimates: When exact values aren't needed
  7. 7. Export results: Save calculations for homework, reports, or documentation

Common Factorial Problems

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%

Factorial Calculator FAQs

Have more questions? Contact us

What Our Users Say

5.0
Based on 1,654 reviews

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!

D
Dr. Emily Carter
Mathematics Professor
October 10, 2024

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.

R
Ryan Mitchell
Computer Science Student
September 28, 2024

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!

S
Sarah Johnson
Data Scientist
October 15, 2024

Love using our calculator?