Factorial and Fibonacci calculator
Compute n!, n!! or the nth Fibonacci number exactly, however large, or list the first n Fibonacci numbers.
Show the working, step by step
Definitions
n! = n × (n − 1) × … × 2 × 1, 0! = 1 F(0) = 0, F(1) = 1, F(n) = F(n − 1) + F(n − 2)
Factorials count the orderings of n items, so they drive permutations and combinations. Consecutive Fibonacci ratios approach the golden ratio, 1.618…
How to use the factorial and Fibonacci calculator
Pick the calculation: factorial n!, double factorial n!!, the Fibonacci number F(n) or the first n Fibonacci numbers. Enter n as a whole number and read the result. Large factorials are shown in full as exact whole numbers, with the digit count, so you can copy them without rounding.
What a factorial means
n! multiplies every whole number from n down to 1. It counts the ways to put n different things in order. Three books can be arranged 3! = 6 ways, and a deck of 52 cards can be shuffled in 52! ways, which is about 8.07 × 1067, more than the number of atoms in the Earth’s oceans several times over. By convention 0! = 1, which keeps formulas such as combinations working for empty selections.
Examples
- 5! = 5 × 4 × 3 × 2 × 1 = 120
- 10! = 3,628,800
- 20! = 2,432,902,008,176,640,000
- 25! = 15,511,210,043,330,985,984,000,000
- 100! has 158 digits, beginning 93,326,215…
Why factorials grow so fast
Each step multiplies by a bigger number, so n! outgrows any exponential. 10! is about 3.6 million but 20! is over 2 quintillion. Stirling’s approximation, n! ≈ √(2πn) (n ÷ e)n, estimates it well for large n: for n = 10 it gives 3,598,696, within 1% of the true value. Exact factorials beyond 20 overflow a normal 64-bit integer, which is why this tool uses arbitrary-precision arithmetic.
Double factorial
The double factorial n!! multiplies every second number: 7!! = 7 × 5 × 3 × 1 = 105 and 8!! = 8 × 6 × 4 × 2 = 384. It is not the factorial of a factorial. It appears in formulas for the volume of high-dimensional spheres, in some integrals and in counting perfect matchings.
The Fibonacci sequence
Fibonacci numbers start 0, 1 and each next number is the sum of the two before: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55. So F(10) = 55, F(20) = 6,765 and F(30) = 832,040. The sequence appears in the branching of plants, in the number of ways to climb stairs taking one or two steps at a time, and in the golden ratio, since F(n+1) ÷ F(n) approaches 1.618 (see the golden ratio calculator). The sequence list mode shows the first n terms.
Factorials in permutations and combinations
The number of ways to arrange r items chosen from n is n! ÷ (n − r)!, and the number of ways to choose them without caring about order is n! ÷ (r! (n − r)!). The permutation and combination calculators do this for you. Choosing 5 cards from 52, for instance, gives 2,598,960 possible hands.
Factorial identities worth knowing
Two relationships save time. First, n! = n × (n − 1)!, which is how you get from 6! = 720 to 7! = 5,040 by multiplying by 7, and it also explains 0! = 1, since 1! = 1 × 0!. Second, a ratio of factorials cancels: 10! ÷ 8! = 10 × 9 = 90, with no need to compute either in full. This cancelling is how combinations such as “52 choose 5” are done by hand.
Trailing zeros in a factorial
Each trailing zero comes from a factor of 10, and factors of 5 are the scarce ones. Count the multiples of 5, then 25, 125 and so on up to n. For 100! that is 20 + 4 = 24 trailing zeros. For 25! it is 5 + 1 = 6, which matches the figure 15,511,210,043,330,985,984,000,000.
Worked counting problems
- Seating: 8 people in a row can sit in 8! = 40,320 orders.
- Passwords: arranging 6 different letters gives 6! = 720 words.
- Round table: seating 8 people around a circle gives (8 − 1)! = 5,040 distinct arrangements.
- Anagrams: the word LEVEL has 5!/(2! × 2!) = 30 arrangements, since L and E each appear twice.
- Race results: the order of finish of 10 runners can occur in 3,628,800 ways.
Fibonacci in everyday counting
The number of ways to climb n stairs taking one or two steps at a time is F(n + 1): 5 stairs gives F(6) = 8 ways. The count of ways to tile a 2 × n strip with dominoes follows the same sequence. F(n) can be written in closed form with the golden ratio, F(n) = (φn − (1 − φ)n) ÷ √5, known as Binet’s formula, which gives F(10) = 55 when rounded.
Fibonacci and factorial sizes
Fibonacci numbers grow exponentially, about 1.618 times per step, so F(100) already has 21 digits (it is 354,224,848,179,261,915,075). Factorials grow faster still, which is why 100! has 158 digits. Comparing the two helps you see the difference between exponential and factorial growth.
When to use a calculator and when to simplify
Do not multiply out a factorial just to divide it by another one. Write the ratio, cancel the common run of factors and multiply what is left: 52! ÷ 47! = 52 × 51 × 50 × 49 × 48 = 311,875,200. Use the calculator for a single exact value, for checking, or when you need the full digit string. For probabilities, the permutation and combination calculators keep the numbers manageable for you.
Limits and common mistakes
- Negative numbers and fractions. The factorial is defined for whole numbers 0 and above here; the gamma function extends it to other values.
- Assuming 0! = 0. It is 1.
- Expecting a decimal. The result is an exact integer, not a rounded value.
- Confusing n!! with (n!)!. The double factorial skips alternate terms.
Common questions
What is 0 factorial?
0! = 1 by convention: there is exactly one way to arrange nothing.
How many trailing zeros does n! have?
One for each factor of 5 (counted with repeats): ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …. 100! ends in 24 zeros.
What is a double factorial?
n!! multiplies every second number down from n: 7!! = 7 × 5 × 3 × 1 = 105.
What is 0 factorial?
0! equals 1. There is exactly one way to arrange zero objects, and this convention keeps combination formulas consistent.
How many digits does 100! have?
158 digits. It is approximately 9.33 × 10157.
Where does the Fibonacci sequence start?
Usually with F(0) = 0 and F(1) = 1. Some books start with 1, 1, so check the convention if your numbers differ by one position.
How large an n can the calculator handle?
It uses exact whole-number arithmetic, so large inputs work but the result can run to thousands of digits, and very large inputs are limited so that the page stays responsive.
How many trailing zeros does a factorial have?
Count the factors of 5: n ÷ 5 + n ÷ 25 + n ÷ 125 and so on, rounding down each. 100! ends in 24 zeros.
What is the double factorial of 9?
9!! = 9 × 7 × 5 × 3 × 1 = 945.
Is there a factorial of a negative number?
Not for integers. The factorial is undefined for negative whole numbers, though the gamma function extends it to most other real numbers.
Related calculators
-
Permutations
nPr uses factorials.
-
Combinations
nCr uses factorials.
-
Prime numbers
Check primes.
-
Rounding calculator
Scientific notation.