Factorials • Topic 1 of 3

Trailing Zeros

A trailing zero is produced by a factor of 10, and 10 = 2 × 5. In any factorial the supply of 2s vastly outnumbers the supply of 5s (every second number is even, but only every fifth is a multiple of 5), so the number of trailing zeros in n! is governed entirely by how many times 5 divides n!. That count is ⌊n/5⌋ + ⌊n/25⌋ + ⌊n/125⌋ + …, continuing until the divisor exceeds n. Each term catches the "extra" 5s: numbers like 25, 50, 125 contribute more than one 5. The classic CAT result is that 100! ends in 24 zeros (20 + 4), not 20. A useful sanity check: the answer is always a touch more than n/4, since the 25, 125 terms add a little to the n/5 term.

✅ Solved examples

1. How many trailing zeros does 100! have?
⌊100/5⌋ + ⌊100/25⌋ = 20 + 4 = 24. (125 > 100, so stop.)
2. Find the number of zeros at the end of 50!.
⌊50/5⌋ + ⌊50/25⌋ = 10 + 2 = 12.
3. How many zeros does 200! end in?
⌊200/5⌋ + ⌊200/25⌋ + ⌊200/125⌋ = 40 + 8 + 1 = 49.
4. What is the smallest n such that n! ends in exactly 3 zeros?
Need ⌊n/5⌋+⌊n/25⌋ = 3. At n = 15: 3 + 0 = 3. At n = 14: 2. So n = 15.

✏️ Practice — try these, take hints as needed

1. Number of trailing zeros in 25!?
Count powers of 5.
⌊25/5⌋ + ⌊25/25⌋.
5 + 1.
6
2. How many zeros does 60! end in?
⌊60/5⌋ + ⌊60/25⌋.
12 + 2.
125 > 60, stop.
14
3. Trailing zeros in 125!?
Go up to ⌊125/125⌋.
25 + 5 + 1.
Add the three terms.
31
4. How many zeros are at the end of 1000!?
Sum ⌊1000/5⌋ … ⌊1000/625⌋.
200 + 40 + 8 + 1.
Stop at 5⁴ = 625.
249
5. Smallest n for which n! ends in exactly 6 zeros?
Find n with 6 fives.
n = 25 gives 5 + 1 = 6.
Check n = 24 gives 4.
25

📝 Topic test — 8 questions

Auto-graded with full solutions; saved to your dashboard. Use the calculator and formula sheet (top-right) any time.

Loading questions…