Based in Maryland, Mathwizurd.com is REVOLUTIONIZINg the world, one post at a time. With topics ranging from Biology to Multivariable Calculus, this website covers the entire academic spectrum.

Number of Trailing Zeroes in a Factorial

Trailing Zeroes

Let's say you have this question:

How many trailing zeroes does 100! have?

Count the tens

The first method that comes to mind is to count the tens or count the 10's and the 2*5's.

1 2 3 4 5 6 7 8 9 10, so in 10! there are 2 zeroes.  The problem with that method is it takes a lot of time, and it's completely unnecessary, because we only did the first 10, and you have 90 more numbers to look at. 

Count the fives

An important idea to understand is that 5 is a limiting factor. In other words, there are fewer 5's than 2's. That's important because in order to multiply to 10 you need a 2 and a 5. 

The reason there are more 2's is that every other number has 2 as a factor. Every fifth number has a 5 as a factor. So, we can say that for every 5 in the factorial, there's a 2. So, all we have to do is count the 5's, and we can count the 0's.

So, what you have to do is count the numbers with one 5 (e.g. 5,10,15,20,30,35,40, 45, 55, etc. ), then add 1 for each number with two 5s (e.g. 25, 50, 75, 100), then add 1 for each number with three 5s (e.g. 125, 250, 375, 500), etc. So, our answer is:

100/5 + 100/25 + 100/125 = 20 + 4 + 0 (there's no 125 in the first 100 positive integers) = 24

So, there are 24 trailing zeroes in 100! 

How many trailing zeroes does 133! have?

This is similar, but I just want to demonstrate that you only take the integer part of each quotient.

133/5 + 133/25 + 133/125 = 26.6 + 5.32 + 1.064 (ignore the decimals) = 26 + 5 + 1 = 32

David Witten

Greatest Common Factor

Path Problems