Zeros at the End

  • Medium
  • Number puzzles
  • Tests: Counting the scarcer of two factors

The puzzle

Multiply together every whole number from 1 to 100. The result is enormous and you are not asked to write it out.

How many zeros does it end in?

Stuck?

One at a time, smallest first. Open only as many as you need — the whole point of the puzzle is the part you work out yourself.

Hint 1

A trailing zero is a factor of 10, and 10 is 2 times 5.

Hint 2

There are far more factors of 2 available than factors of 5, so one of the two is the bottleneck.

Show the answer Hide the answer

Twenty-four.

How to get there

Each trailing zero needs a factor of 2 and a factor of 5. Twos are plentiful - every second number brings one - so the count of fives decides it.

Multiples of 5 up to 100: there are 20 of them, each contributing at least one five.

Multiples of 25 contribute a second five: there are 4 of those (25, 50, 75, 100). No multiple of 125 is in range. Total fives: 20 + 4 = 24.

The technique worth keeping

When something needs two ingredients, count the scarcer one. The repeated division - by 5, then 25, then 125 - is how you count a prime’s total exponent in any factorial.