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 ?
For those who are new to the factorial notation, when we say , we mean that we multiply
and
and
all the way down to
. That is
.
So, where did all the zeros come from? Zero came from 5 multiplied by any even number factor. For example, in , if we multiply
and
, 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 ?
In this example, we know that the product of 10 and any number has 0 as its one’s digit. Also,
is equal to some number with two trailing zeros because we have a 10 and a 5.
If you check your answer, .
Example 3: How many zeros are there in
Expanding , we have,
As you have guessed, the product will have 3 trailing zeroes because the factors contain ,
, and
. 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
. Since there are more even numbers than the multiples of
, 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
?
How about 100!
If we divide by
, the answer is
. Now, what is the reason why
was divided by
in the solution above?
In 100!, we have factors that are multiples of . If we divide them by
,
we get
, still multiples of 5. This means that we still have four
that needs an even pair, so we need to divide again by
. 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
, we divide them by
. That is the reason why we also divide 100 by
.
So, the solution will be
zeroes!
Large Numbers
In larger numbers, we divide the factors by 5 three times (), four times
, and so on, or simply powers of 5. For example, in 130!, 125 is a factor, so we divide it by
and
. That is, we get the sum of the integer quotients of
.
So, if we want to find the number of zeroes in 1000!, we have to add the integer quotients of
.
Well, I think you can already do that. 🙂
So, in general, how many zeros are there in n factorial?