Tuesday, March 24, 2009

Question on Permutation of Zeros in factorial 500

Topic : Permutation
Question : How many zeros are at the end of factorial 500?

Solution :
Highest power of a prime p that divides n!
Let n be a natural number, and let p be a prime. Then the exponent of the highest power of p that divides n! is equal to
N = [n/p] + [n/p2] + [n/p3] + ..... where [x] denotes the greatest integer less than or equal to x.
The highest power of 2 which divides 500! is = [500/2] + [500/2^2] +[500/2^3] + [500/2^4] +[500/2^5] + [500/2^6] +[500/2^7] +[500/2^8] +[500/2^9]
= 250+125+62+31+15+7+3+1 = 494.
The highest power of 5 which divides 500! is = [500/5] + [500/5^2] +[500/5^3] + [500/5^4]=100+20+4 =124
hence the highest power of 10= 5*2 which divides 500! is 124
Hence the number of zeros in 500! is 124.

Another method to solve the same problem.
you get a zero at the end of a product if one of the factors contains a prime factor of 5 and another of the factors contains a prime factor of 2. The prime factors of 2 and 5 multiplied together make 10 and produce a 0 at the end of the product.

If you want to find the number of 0's at the end of 500! in base 10, you need to find the total number of factors of 5 and the total number of factors of 2 in all the numbers from 1 to 500; the smaller of those two numbers will be the number of 0's at the end of 500!

Here is how you would determine the number of 0's at the end of 500!

1) 1 out of every 5 numbers 1 to 500 inclusive (100 of them) contains at least one factor of 5.
2) Of the 100 numbers 1 to 500 inclusive that contain at least one factor of 5, 1 out of every 5 (20of them) contains a second factor of 5.
3) Of the 20 numbers 1 to 500 inclusive that contain a second factor of 5, 1 out of every 5 (4 of them) contains a third factor of 5.
The total number of factors of 5 contained in the numbers 1 to 500 inclusive is then
100 + 20 + 4 =124
in short :
500/5 = 100
100/5 = 20
20/5 = 4
4/5 = 0
----
124
( Write only the quotient)
similarly, The total number of factors of 2contained in the numbers 1 to 500 inclusive is then

500/2 = 250
250/2 = 125
125/2 = 62
62/2 = 31
31/2 = 15
15/2 = 7
7/2 = 3
3/2 = 1
1/2 = 0
-----
494
so there are 124 factors of 5 , 494 factors of 2 and we get 124 combinations of 5x2 ( match the 124 5's with the 124 2's -- no more 5's left -so we get only 124 combinations of 2 x5 ).thats why we take the smaller of the above two calculations.
(however, 500/2= 250 > 124 so we need not perform the other calculations.)
and the answer is 124 0's at the end of 500 !

No comments:

Post a Comment