🔢

Factorial Calculator (n!) Studio

Step-by-Step Breakdown • Expressions Solver • Permutations & Combinations

✨

Factorial & Expression Solver

Calculate exact factorials, solve equations (e.g. 5! + 3! or 10!/5!), or use the slider

5!
Type an integer (e.g. 10), a factorial notation (10!), or complex formulas.
5
Drag to instantly compute exact factorials from 0! to 170!.
Result (5!):
120

Step-by-Step Multiplication

5! = 5 × 4 × 3 × 2 × 1
= 5 × 4!
= 20 × 3!
= 60 × 2!
= 120 × 1
= 120

Mathematical Presets & Benchmarks

Quickly load specific mathematical constants, arrangements, and combinatorics limits

Arrangements (nPr) & Selections (nCr)

Calculate probabilities, permutations, and choices using optimized overflow-proof algorithms

Permutations (nPr)
n! / (n - r)!
10P3 =720
Order matters (e.g. race finishes, passcode digits).
Combinations (nCr)
n! / [r! × (n - r)!]
10C3 =120
Order does not matter (e.g. lottery picks, team formations).

Stirling's Approximation Studio

Estimate giant factorials up to 10,000! and track mathematical error tolerances

Stirling's theorem calculates $\ln(n!) \approx n\ln(n) - n + 0.5\ln(2\pi n)$ to bypass double-precision overflow limits.

Error Matrix (Exact vs Stirling)

Target Factorial:5!
Exact Value:120
Stirling's Estimate:1.180 × 10^2
Absolute Error:1.98
Relative Margin:1.6500%
💡 Margin drops below **1%** at $n \ge 10$. As $n \to \infty$, relative error approaches zero.

Recent Tape Calculations

combination 10C3→120
permutation 10P3→720
factorial 5!→120

Factorial Reference Chart (0! to 20! Quick Guide)

Instant numerical guides, digit counts, and landmark associations from 0! to 20!

A factorial, written as n!, is the product of all positive integers from 1 up to and including n. By mathematical convention, 0! = 1 because there is exactly one way to arrange zero items — the empty arrangement. Factorials grow extremely rapidly: 10! is already 3,628,800, while 20! exceeds 2.4 quintillion (2,432,902,008,176,640,000). This explosive growth makes factorials central to probability theory, combinatorics, and algorithm complexity.

nn! (Factorial Value)Digit CountCommon Association
011Empty set permutation (by definition)
111Single element — only one arrangement
221Two items: AB or BA
361RGB colour orderings
4242Card suit orderings
512035-character PIN permutations
67203Chess piece movement orderings
75,0404Days-of-week arrangement count
840,3205Rubik's Cube corner arrangements
9362,8806Sudoku digit arrangements
103,628,800710-player team lineup permutations
1139,916,800811-player football formation orders
12479,001,600912-month calendar arrangement count
136,227,020,80010Standard deck suit orderings (partial)
1487,178,291,20011Cryptographic key space baseline
151,307,674,368,00013Tournament bracket permutations
1620,922,789,888,0001416-bit register state orderings
17355,687,428,096,00015Genome sequencing combinatorics
186,402,373,705,728,00016Chessboard piece placements
19121,645,100,408,832,00018Protein folding sequence counts
202,432,902,008,176,640,00019Upper limit for 64-bit integer storage
💡 Practical Mathematics

Real-World Applications of Factorials

How factorial mathematics powers cryptography, algorithm design, probability modeling, and modern scientific computing.

🔀
P(n, k) = n! ÷ (n − k)!

Permutations — Ordered Arrangements

A permutation counts the number of ways to arrange k items selected from n distinct objects where order matters. The formula is P(n, k) = n! ÷ (n − k)!. If a race has 10 competitors and you want to know how many possible 1st-2nd-3rd podium combinations exist, that is P(10, 3) = 10! ÷ 7! = 720. Permutations appear in cryptography (counting possible password sequences), scheduling (task ordering in operating systems), and genetics (counting codon sequence arrangements in RNA).

🔒 Cryptography⏱️ OS Scheduling🧬 RNA Genetics
🎲
C(n, k) = n! ÷ (k! × (n − k)!)

Combinations — Unordered Selections

A combination counts the number of ways to choose k items from n objects where order does not matter. The formula is C(n, k) = n! ÷ (k! × (n − k)!), also written as "n choose k". Selecting 5 lottery numbers from 49 gives C(49, 5) = 1,906,884 possible tickets. Combinations appear in probability distributions (binomial theorem), card game hand counting, and statistical sampling design where only which items are selected matters, not their sequence.

🎟️ Lottery Odds🃏 Card Games📊 Statistical Sampling
📐
eˣ = Σ (xⁿ ÷ n!)

Taylor Series & Calculus

Factorials appear as denominators in Taylor series expansions, which approximate mathematical functions as infinite polynomials. The exponential function e^x equals the sum of x^n ÷ n! for n from 0 to infinity. The sine and cosine functions, natural logarithm, and virtually every transcendental function used in physics and engineering is computed via factorial-denominator Taylor series internally by calculators and programming language math libraries.

📈 Taylor Series〰️ Trigonometry⚙️ Calculator Engines
⚡
O(n!) Complexity

Computer Science — Algorithm Complexity

Factorial time complexity, written O(n!), is the worst-case growth rate of brute-force algorithms that enumerate every possible permutation of the input. The Travelling Salesman Problem (finding the shortest route visiting n cities) has O(n!) naive complexity because checking every possible route ordering requires n! iterations. For n = 15 cities, that is over 1.3 trillion route checks — illustrating why heuristic algorithms are necessary for even modest problem sizes. Understanding factorial growth is essential for algorithm design and NP-hard problem analysis.

🗺️ Travelling Salesman🧩 NP-Hard Problems💻 Algorithm Design
📊
P(X=k) = C(n,k)·pᵏ(1−p)ⁿ⁻ᵏ

Probability — Binomial Distribution

The binomial distribution, which models the probability of getting exactly k successes in n independent trials (such as coin flips or quality control pass/fail tests), uses the combination formula C(n, k) directly. Calculating the probability that exactly 3 out of 10 components fail a stress test uses 10! in its numerator. Epidemiologists use factorial-based formulas to model disease spread probabilities, clinical trial statisticians use them for significance testing, and insurance actuaries use them for mortality rate modelling.

🦠 Epidemiology🧪 Clinical Trials📋 Actuarial Science

Overview & Capabilities

Compute exact mathematical factorials (\(n!\)), double factorials (\(n!!\)), permutations (\(nPr\)), and combinations (\(nCr\)) with our Factorial Calculator! Powered by arbitrary-precision BigInt arithmetic, our tool computes exact multi-thousand-digit integers without floating-point overflow or scientific rounding errors.

Tutorial

How to Use

01
Enter a non-negative integer \(n\) (e.g. 0 to 1000).
02
Optionally enter \(r\) to calculate Permutations (\(nPr\)) or Combinations (\(nCr\)).
03
Click 'Calculate Factorial' to evaluate.
04
View the full exact digit string, trailing zero count, and scientific notation.
05
Review the sequential product expansion and Stirling estimate comparison.
Capabilities

Key Features

Arbitrary-Precision BigInt Engine: Calculates exact factorial integers for values up to \(n = 1000\) without precision loss.
Permutations & Combinations (nPr, nCr): Built-in combinatorial solvers for probability distributions.
Trailing Zeros Counter (Legendre's Formula): Computes exact number of terminal zeros produced by prime factor 5.
Stirling's Asymptotic Approximation: Compares exact results against \(n! \approx \sqrt{2\pi n}(\frac{n}{e})^n\).
Double Factorials & Subfactorials (!n): Evaluates odd/even skip factorials and derangements.
Applications

Common Use Cases

Mathematics Education: Learn factorial concepts with visual breakdowns
Combinatorics: Calculate permutations and combinations for probability
Algorithm Analysis: Understand O(n!) time complexity
Statistics: Compute binomial coefficients and probability distributions
Programming: Verify factorial implementations and edge cases
Puzzle Solving: Calculate possible arrangements and selections
Game Theory: Determine possible game states and outcomes
Cryptography: Understand keyspace sizes and combinations
Guidance

Tips & Best Practices

💡
Use the expression solver for ratios like 10!/5! to avoid overflow
💡
Check the step-by-step breakdown to understand the calculation
💡
Use permutations (nPr) when order matters (e.g., race positions)
💡
Use combinations (nCr) when order doesn't matter (e.g., lottery)
💡
Remember: 0! = 1 by mathematical definition
💡
Maximum factorial is 170! due to computational limits
💡
Use scientific notation for very large results
💡
Save time by using popular examples for common calculations
Answers

Frequently Asked Questions

Q What is a Factorial (n!)?

The factorial of a non-negative integer n is the product of all positive integers less than or equal to n: n! = n × (n - 1) × (n - 2) × ... × 2 × 1. For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.

Q Why is 0! equal to 1?

0! = 1 by mathematical definition to preserve recursive identities like n! = n × (n - 1)!, which for n = 1 gives 1! = 1 × 0!, requiring 0! = 1. Combinatorially, there is exactly 1 way to arrange an empty set of zero items.

Q How do you count trailing zeros in a factorial using Legendre's Formula?

Trailing zeros are formed by pairs of 2s and 5s (since 2 × 5 = 10). Because factors of 2 are abundant, count factors of 5: Zeros = floor(n/5) + floor(n/25) + floor(n/125) + ... For 100!: floor(100/5) + floor(100/25) = 20 + 4 = 24 trailing zeros.