Number Theory

Maximum Power of a Prime Number Contained in N!

Suppose we have to calculate the power of a prime number ‘\(a\)’  in  factorial \(N\)

Maximum power = \(\left[ {\frac{N}{a}} \right] + \left[ {\frac{N}{{{a^2}}}} \right] + \left[ {\frac{N}{{{a^3}}}} \right] + ....\)

Where \(\left[ {\frac{N}{{{a^n}}}} \right]\) shows greatest integer function.

Example 29: Find the maximum power of 2, 3 and 6 in \(50!\)

Solution: Powers of 2,

\(\left[ {\frac{{50}}{2}} \right] + \left[ {\frac{{50}}{{{2^2}}}} \right] + \left[ {\frac{{50}}{{{2^3}}}} \right] + \left[ {\frac{{50}}{{{2^4}}}} \right] + \left[ {\frac{{50}}{{{2^5}}}} \right]\)

= 25 + 12 + 6 + 3 + 1 =47

Powers of 3,

\(\left[ {\frac{{50}}{3}} \right] + \left[ {\frac{{50}}{{{3^2}}}} \right] + \left[ {\frac{{50}}{{{3^3}}}} \right]\)= 16 + 5 + 1=22

Powers of 6 can not be calculated by this method as the number 6 is not a prime number. Powers of 6 can be calculated by using pairs of 2 and 3. Since ‘3’ has only 22 powers, hence there are only 22 pairs of 2 and 3. So powers of 6 =22

Example 30: Find the total number of zeroes at the end of 100!.

Solution: To calculate number of zeroes at the end of 100!, we must calculate powers of 10 contained in the number 100! and powers of 10 is the number of pairs of 2 and 5.

Powers of 2 in 100!  =

\(\left[ {\frac{{100}}{2}} \right] + \left[ {\frac{{100}}{{{2^2}}}} \right] + \left[ {\frac{{100}}{{{2^3}}}} \right] + \left[ {\frac{{100}}{{{2^4}}}} \right] + \left[ {\frac{{100}}{{{2^5}}}} \right] + \left[ {\frac{{100}}{{{2^6}}}} \right]\) 

\(=50 + 25 + 12 + 6 + 3 + 1 =97\).

Powers of 5 in 100! =\(\left[ {\frac{{100}}{5}} \right] + \left[ {\frac{{100}}{{{5^2}}}} \right]\) = 20 + 4 = 24.

Hence total powers of 10 = 24 or 

Total number of zeroes at the end of 100! =24.

Example 31: Find the number of zeroes at the end of  \(5 \times 10 \times 15 \times  \ldots  \ldots ..495 \times 500\)

Solution: First we will simplify this number:

Suppose \(N\; = {\rm{ }}5 \times 10 \times 15 \times 20 \times 25 \times  \ldots  \ldots ..495 \times 500\)  

\( = {\rm{ }}{5^{100}}\left( {1 \times 2 \times 3 \times 4 \ldots  \times 99 \times 100} \right)\)

\(N = {\rm{ }}{5^{100}}\left( {100!} \right)\)

or \(N\) has 97 powers of 2 ( as discussed in the above example) and 124 powers of 5. 

Total number of powers of 10 is 97

Hence the number is ending with 97 zeroes.