How to find the number of trailing zeroes ?

This topic has expert replies
User avatar
Master | Next Rank: 500 Posts
Posts: 490
Joined: Thu Jul 04, 2013 7:30 am
Location: Chennai, India
Thanked: 83 times
Followed by:5 members

How to find the number of trailing zeroes ?

by Uva@90 » Thu Oct 31, 2013 8:06 pm
Hi All,
Is there any short method to find the number of trailing zeroes in any factorial.

for example in 30! how to find the number of trailing zeroes ?

Thanks in advance.

Regards,
Uva.
Known is a drop Unknown is an Ocean

User avatar
GMAT Instructor
Posts: 15539
Joined: Tue May 25, 2010 12:04 pm
Location: New York, NY
Thanked: 13060 times
Followed by:1906 members
GMAT Score:790

by GMATGuruNY » Thu Oct 31, 2013 8:23 pm
If 60! is written out as an integer, with how many consecutive 0's will that integer end?
6
12
14
42
56
60! = 60*59*58*....*3*2*1.

Since 10=2*5, EVERY COMBINATION OF 2*5 contained within the prime-factorization of 60! will yield a 0 at the end of the integer representation of 60!.
The prime-factorization of 60! is composed of FAR MORE 2'S than 5's.
Thus, the number of 0's depends on the NUMBER OF 5's contained within 60!.

To count the number of 5's, simply divide increasing POWERS OF 5 into 60.

Every multiple of 5 within 60! provides at least one 5:
60/5 = 12 --> twelves 5's.
Every multiple of 5² provides a SECOND 5:
60/5² = 2 --> two more 5's.
Thus, the total number of 5's contained within 60! = 12+2 = 14.

The correct answer is C.

Another example:

If 200! is written out as an integer, with how many consecutive 0's will that integer end?

Every multiple of 5 within 200! provides at least one 5:
200/5 = 40 --> forty 5's.
Every multiple of 5² provides a SECOND 5:
200/5² = 8 --> eight more 5's.
Every multiple of 5³ provides a THIRD 5:
200/5³ = 1 --> one more 5.
Thus, the total number of 5's contained within 200! = 40+8+1 = 49.
Private tutor exclusively for the GMAT and GRE, with over 20 years of experience.
Followed here and elsewhere by over 1900 test-takers.
I have worked with students based in the US, Australia, Taiwan, China, Tajikistan, Kuwait, Saudi Arabia -- a long list of countries.
My students have been admitted to HBS, CBS, Tuck, Yale, Stern, Fuqua -- a long list of top programs.

As a tutor, I don't simply teach you how I would approach problems.
I unlock the best way for YOU to solve problems.

For more information, please email me (Mitch Hunt) at [email protected].
Student Review #1
Student Review #2
Student Review #3

User avatar
Master | Next Rank: 500 Posts
Posts: 490
Joined: Thu Jul 04, 2013 7:30 am
Location: Chennai, India
Thanked: 83 times
Followed by:5 members

by Uva@90 » Thu Oct 31, 2013 8:34 pm
GMATGuruNY wrote:
If 60! is written out as an integer, with how many consecutive 0's will that integer end?
6
12
14
42
56
60! = 60*59*58*....*3*2*1.

Since 10=2*5, EVERY COMBINATION OF 2*5 contained within the prime-factorization of 60! will yield a 0 at the end of the integer representation of 60!.
The prime-factorization of 60! is composed of FAR MORE 2'S than 5's.
Thus, the number of 0's depends on the NUMBER OF 5's contained within 60!.

To count the number of 5's, simply divide increasing POWERS OF 5 into 60.

Every multiple of 5 within 60! provides at least one 5:
60/5 = 12 --> twelves 5's.
Every multiple of 5² provides a SECOND 5:
60/5² = 2 --> two more 5's.
Thus, the total number of 5's contained within 60! = 12+2 = 14.

The correct answer is C.

Another example:

If 200! is written out as an integer, with how many consecutive 0's will that integer end?

Every multiple of 5 within 200! provides at least one 5:
200/5 = 40 --> forty 5's.
Every multiple of 5² provides a SECOND 5:
200/5² = 8 --> eight more 5's.
Every multiple of 5³ provides a THIRD 5:
200/5³ = 1 --> one more 5.
Thus, the total number of 5's contained within 200! = 40+8+1 = 49.
Thanks a Ton Mitch.
Now I got it.

Regards,
Uva.
Known is a drop Unknown is an Ocean

Master | Next Rank: 500 Posts
Posts: 269
Joined: Thu Sep 19, 2013 12:46 am
Thanked: 94 times
Followed by:7 members

by mevicks » Thu Oct 31, 2013 8:47 pm
To find the number of trailing zeroes of n! find the number of the prime factors of 5 in n!

All factorials greater than 1! are even, as they are all multiples of 2.
Also, all factorials from 5! upwards are multiples of 10 (and hence have a trailing zero as their final digit), because they are multiples of 5 and 2

(note the trick mentioned below works for other prime numbers too; 7, 3, 2 etc, ie to find how many times a prime number appears in a factorial)
Now to find the number of the prime factors of 5 in a factorial:
Simply keep dividing the number by 5 and the resultant quotient until you reach a quotient less than the prime number 5 (ignoring the final remainder in each case) ; finally add up all the quotients

Eg:
No of prime factors of 5 in 10! : (10/5) = 2
TOTAL no of 5's is 2
We will have atleast two 2's to pair up with the above two 5's to form two 10s.
Trailing zeroes : 2

No of prime factors of 5 in 12! : (12/5) = 2
TOTAL no of 5's is 2
Trailing zeroes : 2

No of prime factors of 5 in 30! : (30/5) = 6 ---> (6/5) = 1
TOTAL no of 5's is 6 + 1 = 7
Trailing zeroes : 7

No of prime factors of 5 in 98! : (98/5) = 19 ---> (19/5) = 3
TOTAL no of 5's is 19 + 3 = 22
Trailing zeroes : 22

Try out the above scenario yourself and test your answers here : https://www.nitrxgen.net/factorialcalc.php

Hope that helps!

GMAT Instructor
Posts: 2630
Joined: Wed Sep 12, 2012 3:32 pm
Location: East Bay all the way
Thanked: 625 times
Followed by:119 members
GMAT Score:780

by Matt@VeritasPrep » Sat Nov 02, 2013 11:00 pm
Quick addendum here - the GMAT likes to ask very similar questions about other numbers too. A question like "What's the greatest power of 3 that is a factor of 30!?" is more or less the same thing as what we have above, except we're counting 3's rather than 5's.

A follow up Q to practice:

What's the greatest power of 12 that is a factor of 60!?

Master | Next Rank: 500 Posts
Posts: 269
Joined: Thu Sep 19, 2013 12:46 am
Thanked: 94 times
Followed by:7 members

by mevicks » Sat Nov 02, 2013 11:36 pm
Matt@VeritasPrep wrote: A follow up Q to practice:

What's the greatest power of 12 that is a factor of 60!?
Hi Matt,

Is the answer 28 for the above question?

My reasoning:

We need to find the greatest power of 12 that is a factor of 60!
So basically how many 12s are there in 60!

Breaking it down to the lowest prime factors of 2s and 3s:

No. of 2s = 56
No. of 3s = 28

Now, we need two 2s and one 3 to make a 12, so we have (56/2) = 28 options for building two 2s and 28 options for building a 3

12 = (2 * 2 * 3)

We can build 28 12s; thus the highest factor of 12 we can can have is 28