# Highest Power of a Number in a Factorial

In the video below, we will have a look at the techniques to calculate the Highest Power of a Number in a Factorial.

Factorial of a number n is given by $n! = n$ x $(n-1)$ x $(n-2)$ x $(n-3)…2$ x $1$

Given a number x, how do we find the highest power of x in n! ? In order to solve this, we must first understand the concept of Greatest Integer Function.

#### Greatest Integer Function:

If x is an integer, then the greatest integer function of x is the greatest integer that is less than or equal to x. It is represented by [x]

**Example**:

1. Greatest Integer less than or equal to 2.1 => [2.1] = 2

2. [1.9] = 1

3. [-2.1] = -3 (Since -3 is the greatest integer that is less than or equal to -2.1)

**Calculating Highest power of a number in a factorial.**

If $p$ is prime number, then the highest power of $p$ in a factorial $n$ is given by

$[\frac{n}{p}] + [\frac{n}{p^2}] + [\frac{n}{p^3}] + …$

Highest Power of prime number in factorial

**Example:** Highest power of 3 in 15! is given by,

=> $[\frac{15}{3}] + [\frac{15}{3^2}] + [\frac{15}{3^3}] + …$

=> 5 + 1 + 0

=> 6

Highest Power of composite number in a factorial

**Example: **Highest power of 15 in 24!

Step 1: Express 15 in terms of its prime factors

15 = 3 x 5

Step 2 : Among the prime factors 3 and 5, highest power of 5 in 24! is less than the highest power of 3 in 24!. Hence the power of 15 in 24! will be equal to the highest power of 5 in 24!

Highest power of 5 in 24! = [$\frac{24}{5}$] + [$\frac{24}{5^2}$]

= 4 + 0 = 4

Hence the highest power of 15 in 24! = 4

**Note: If $p$ is a prime number, highest power of $p^a$ present in a factorial n is given by**

[$\frac{\text{Highest power of p in n!}}{a}$]** **

**Example: **Highest power of 9 in 32!

Highest power of 3$^2$ in 32! => [$\frac{\text{Highest power of 3 in 32!}}{2}$]** **

=> [$\frac{\frac{32}{3} + \frac{32}{3^2} + \frac{32}{3^3}}{2}$]** **

=> [$\frac{10 + 3 + 1}{2}$] => 7

Can you now calculate the

- Highest power of 7 in 5000!
- Number of zeroes present at the end of 1000!
- Right most non-zero digit of 10!

## Comments

## Nikhil

suppose if we have to find the highest power if 2 in 17!,

then it would take

[17/2]+[17/2^2]+…..+[17/2^5]

=>8+4+2+1+0

=>15

In my opinion i think we should proceed and find till when the GIF becomes zero .

IS IT RIGHT???