Hello, can somebody please explain me how to find out the number of trailing zeros in n!. regards
Fun question! I just want to stress a major point before we dive into this:
This is not the kind of thing you want to memorize in order to do well on the Quant section.
Yes, there is actually a formula here. But two things to remember:
[1)] How often do you see GMAT Quant questions that can be solved by one simple application of a formula? Almost never!
[2)] Even when there is a simple formula, you'll never be able to memorize your way to a good score!
Instead, we should focus on mastering processes
and new ways of thinking
that allow us to do well on any problem the GMAT throws our way!
So, I'll discuss this question with all of these points in mind. Just to make sure we're all on the same page, let me pose the question precisely:
If n is a positive integer, how many zeros are at the end of n ! ?
Let's start by looking for patterns.
1! = 1 ... no zeros
2! = 2 ... no zeros
3! = 6 ... no zeros
4! = 24 ... no zeros
5! = 5*4*3*2*1 = 120 ... one zero
Ah ha! We finally got a zero. Let's keep going to see what happens next:
6! = 6*(5!) = 720 ... still just one zero
7! = 7*(6!) = 7*720 ... Ok
, let's not forget that we have only two minutes on average for a Quant problem. Could we figure out 7!? Of course! What about 8! ... or 9!? Sure, but this is starting to get a little ridiculous. You should never have to actually compute a factorial larger than 6! on the GMAT.
If you're actually working it out, you're doing it the wrong way. Classic example of what I call "Mathematically Correct, but GMAT Incorrect."
So let's step back a moment and think about what is really going on here. With 4!, we had 24 (no zeros), but suddenly with 5! we had 120 (one zero). What happened here to give us that zero?
Let's think more about what it really means
to have a zero at the end. Any ideas?It's a multiple of 10.
4! = 24 is not a multiple of 10, but 5! is. How do we know? Just look at the components:5
*1 = 120
It's the pair of the 5 and the 2 that give us a factor of 5*2 = 10. As we go to higher factorials (6!, 7!, 8!, etc.) we still
have that 5 and 2, so any n
! with n
≥ 5 will still have that last zero.
Ok, so now we need to think about how we might get a second zero at the end. What do the numbers 700, 1200, 2300, and 127824963400 all have in common? Well, they all end in two zeros, and they are all multiples of ...
100! (Not 100-factorial. I was just excited to say "100" that time!) So what do we need to be a multiple of 100? Well 100 = 10*10 = (2*5)(2*5).
Now it's time to start making some connections. Each zero at the end of n
! is the result of a paired up 2 and 5. What's the first value of n
that will give us two zeros at the end of n
= 10 (n
= 5 gave us the first 5, so n
= 10 is the smallest value of n
for which we'll get another factor of 5 in the product that defines n
!.) We already have all the 2's we could ever want. The restricting factor here is 5. Now we can extend our observations to a general statement:
The number of zeros at the end of n! is equal to number of factors of 5 in n !
In essence, this is the answer to your question! Now, it's not that practically useful. Let's try a specific example to see what else is going on.Example.
How many zeros are at the end of 75!Solution.
We need to count factors of 5. For starters, we have 75/5 = 15 multiples of 5 that are less than or equal to 75. So, is the answer 15? Not quite, because not all factors of 5 are created equal! Consider 25, which is 25 = 5*5, so we have an extra factor of 5 there. Any others? Consider multiples of 25: 50 = 2*25 (extra factor of 5 there) and 75 = 3*25 (extra factor of 5 there as well). So in total, we have 15 (multiples) + 3 (extras) = 18 factors of 5. Therefore we have 18 zeros at the end of 75!.
In summary, our thought process here has lead to a solid general process:
- To determine the number of trailing zeros for n!, find the number of factors of 5 in n!
- To determine the number of factors of 5, start by counting the number of multiples of 5.
- Finally, consider the number of "extra" factors of 5 we get due to powers of 5 and their multiples.
Hope that helps!
P.S. If you need to be convinced that memorizing a formula is not
the way to go here, I'll just mention that what we're really doing here is using a special case De Polignac's Formula applied to the prime 5. Take a look at http://en.wikipedia.org/wiki/De_Polignac%27s_formula
if you dare! You might need a Ph.D. in math to really understand this formula, but I guarantee that you don't need a Ph.D. in Math to do well on the GMAT!