# How Many Zeros Are There in n factorial

How many trailing zeros are there in 100! (! is read as factorial)? This is one of the most common problems in elementary school and middle school math competitions and for those who have memorized the strategy, this can be solved in less than five seconds. There are (100/5) + (100/25) = 24 trailing zeros in 100!. But why does the trick works?

Small Cases

Example 1: How many zeroes are there in $6!$?

For those who are new to the factorial notation, when we say $6!$, we mean that we multiply $6$ and $5$ and $4$ all the way down to $1$. That is

$6! = 6 \times 5 \times 4 \times 3 \times 2 \times 1 = 720$.

So, where did all the zeros come from? Zero came from 5 multiplied by any even number factor. For example, in $6!$,  if we multiply $6$ and $5$, this will give us 30, a number with one trailing zero. Notice that none of the remaining numbers in the multiplication can add another trailing zero.

Example 2: How many zeros are there in $10!$?

In this example, we know that the product of 10 and any number has 0 as its one’s digit. Also,

$10! = 10 \times 9 \times 8 \times 7 \times 6 \times 5 \times 4 \times 3 \times 2 \times 1$

is equal to some number with two trailing zeros because we have a 10 and a 5.

If you check your answer, $10! = 3628800$.

Example 3: How many zeros are there in  $15!$

Expanding $15!$, we have,

$15! = 15 \times 14 \times \cdots \times 10 \times \cdots \times 5 \times 4 \times 3 \times 2 \times 1$

As you have guessed, the product will have 3 trailing zeroes because the factors contain $15$, $10$, and $5$. Notice that three of them are multiples of 5. Ten is equal to 5(2), and the two numbers multiplied by any even number can also give a trailing $0$. Since there are more even numbers than the multiples of $5$, we are sure that every multiple of 5 can be paired with an even number. Therefore, we can say that if you want to know the numbers of n!, just divide it by 5. For example, how many 0s are there in 22!. There are 4 multiples of 5 less than 22 (20, 15, 10, and 5), so we know that 22! has four trailing zeroes! Or simply, what is the integer quotient (Can you see why?) of $\frac{22}{5}$?

If we divide $100$ by $5$, the answer is $20$. Now, what is the reason why $100$ was divided by $25$ in the solution above?

In 100!, we have factors that are multiples of $25$. If we divide them by $5$, $(25, 50, 75, 100)/5$ we get $(5, 10, 15, 20)$, still multiples of 5. This means that we still have four $5's$ that needs an even pair, so we need to divide again by $5$. Now, since we have already counted the 5’s in the first division, we need to count the second set of 5’s. Instead of dividing again by $5$, we divide them by $25$.  That is the reason why we also divide 100 by $25$.

So, the solution will be

$\displaystyle \frac{100}{5} + \frac{100}{25 }= 20 + 4 = 24$ zeroes!

Large Numbers

In larger numbers,  we divide the factors by 5 three times ($5^3$), four times $(5^4)$, and so on, or simply powers of 5. For example, in 130!, 125 is a factor, so we divide it by $5, 5^2$ and $5^3$. That is, we get the sum of the integer quotients of

$\displaystyle \frac{130}{5} + \frac {130}{25} +\frac {130}{125} = 32$.

So, if we want to find the number of zeroes in 1000!, we have to add the integer quotients of

$\displaystyle \frac{1000}{5} + \frac{1000}{25} + \frac{1000}{125} + \frac{1000}{625}$.

Well, I think you can already do that. 🙂

So, in general, how many zeros are there in n factorial?

## 10 thoughts on “How Many Zeros Are There in n factorial”

1. Nice one sir!

• 123/5 + 123/25(ie 5×5)
24.6. + 4.92. Which is 28 after neglecting decimals. So there are 28 zeros.
NOTE: 123/125(ie 5x5x5) is less than 1 hence we stop at 5×5(5 sq)