Factorial Calculator — Step-by-Step Solutions
The Factorial Calculator computes factorials (n!), double factorials (n!!), displays factorial tables, and evaluates the Gamma function for non-integer values. It uses BigInt for exact results up to 170!.
Enter a number to see its factorial with step-by-step expansion showing the full multiplication chain. The table mode displays factorials from 0! to 20! with digit counts.
Your calculations will appear here
How to Use the Factorial Calculator
- Choose a mode: n! Factorial, n!! Double Factorial, Factorial Table (0-20), or Gamma Function for non-integer inputs.
- Enter a non-negative whole number in the box (for the Gamma mode you can enter a decimal such as 4.5). The result appears as you type.
- For ordinary factorials the answer is exact, with every digit shown, even when it has hundreds of digits. For n up to 20 the expansion n x (n - 1) x ... x 1 is written out too.
- Use the table mode to look up factorials from 0! to 20! together with their digit counts, which is handy for permutation and combination problems.
Formula and Theory
The factorial of a non-negative integer n, written n!, is the product of all positive integers up to n: n! = n x (n - 1) x ... x 2 x 1. By convention 0! = 1, which keeps formulas such as the number of ways to arrange zero objects (exactly one way) consistent.
Factorials count arrangements. There are n! ways to order n different objects, and they sit inside the formulas for permutations, nPr = n! / (n - r)!, and combinations, nCr = n! / (r! (n - r)!). They also appear in the Taylor series of e^x, sin x and cos x and in the Poisson and binomial distributions.
Factorials grow extremely fast: 10! is already 3,628,800, 20! is about 2.4 x 10^18, and 21! no longer fits in a standard 64-bit integer, which is why this calculator uses arbitrary-precision integers. The Stirling approximation, n! is roughly sqrt(2 pi n) (n/e)^n, is useful for estimating large factorials.
The double factorial n!! multiplies every second number: n x (n - 2) x (n - 4) x ... down to 2 or 1. It is not the same as (n!)!. The Gamma function extends the factorial to non-integers through n! = Gamma(n + 1), with (1/2)! = sqrt(pi) / 2.
Worked Examples
Example 1: A small factorial
Problem: Calculate 5!.
Solution: 5! = 5 x 4 x 3 x 2 x 1. Multiply step by step: 5 x 4 = 20, 20 x 3 = 60, 60 x 2 = 120, 120 x 1 = 120.
Answer: 120
Example 2: Using factorials for a combination
Problem: How many ways can you choose 3 people from 10? That is 10C3 = 10! / (3! x 7!).
Solution: 10! = 3,628,800. 3! = 6 and 7! = 5,040, so the denominator is 6 x 5,040 = 30,240. 3,628,800 / 30,240 = 120. (Cancelling 7! first gives the same: 10 x 9 x 8 / 6 = 720 / 6 = 120.)
Answer: 120 ways
Example 3: Double factorial
Problem: Calculate 8!! and 7!!.
Solution: 8!! = 8 x 6 x 4 x 2 = 384. 7!! = 7 x 5 x 3 x 1 = 105.
Answer: 8!! = 384 and 7!! = 105
Example 4: Gamma function for a non-integer
Problem: What is 4.5! (that is, Gamma(5.5))?
Solution: Use Gamma(n + 1) = n x Gamma(n) repeatedly: Gamma(5.5) = 4.5 x 3.5 x 2.5 x 1.5 x 0.5 x Gamma(0.5), and Gamma(0.5) = sqrt(pi) = 1.7725. The product 4.5 x 3.5 x 2.5 x 1.5 x 0.5 = 29.53125, so Gamma(5.5) = 29.53125 x 1.77245 = 52.3428.
Answer: 52.3428 (approximately)
Frequently Asked Questions
Why is 0! equal to 1?
Can you take the factorial of a negative number?
What is the largest factorial this calculator can compute?
How many digits does n! have?
What is the difference between n!! and (n!)!?
What is the factorial of a decimal?
Related General Calculators
Percentage Calculator
Calculate percentages instantly. Find what percent of a number, percentage change, and percentage difference. Free and fast.
Fraction Calculator
Add, subtract, multiply, and divide fractions. Simplify fractions and convert to mixed numbers. Free online fraction calculator.
Ratio Calculator
Simplify ratios and find missing values in proportions. Free online ratio calculator with step-by-step results.
Exponent Calculator
Calculate powers and exponents instantly. Compute base raised to any power including negative and fractional exponents. Free online tool.
Log Calculator
Calculate logarithms with any base. Find natural log (ln), log base 10, and custom base logarithms. Free online log calculator.
Factor Calculator
Find all factors, prime factorisation, factor pairs, GCD, and LCM. Free online factor calculator with instant results.