Associated Topics || Dr. Math Home || Search Dr. Math

### Trailing Zeros and Zero Factorial

```
Date: 04/07/98 at 00:57:09
From: mark lopez
Subject: College math (mat142)

How many trailing zeros are there for 100! ?

I found that 69! = 1.711224524 x 10^98. This is the highest my
calculator will go. I then started working downward from a 100 to 70.
From this I came up with 5.453767996 x 10^59.

Do I multiply 98 by 59 to come up with answer, or do I add the two
numbers?  If you can help me with this, I would greatly appreciate it.

Thank you.
```

```
Date: 04/07/98 at 17:05:37
From: Doctor Rob
Subject: Re: College math (mat142)

The trick here is not to calculate 100! on your calculator (which only
gives you ten digits of accuracy), but to figure out how high a power
of 10 goes into 100! evenly. For every trailing zero, there is a power
of 10 that divides 100! evenly. In order to do that, since 10 = 2*5,
we need to figure the highest powers of 2 and 5 dividing 100! and take
the lesser of the two exponents. (Why?)

Consider what happens when we multiply together 1*2*3*4*5*6*...,
starting with the lowest numbers first. Every fifth number, starting
with 5, is divisible by 5. That gives you 100/5 = 20 factors of 5 in
100!. But there are more. Every 25th number, starting with 25, has an
extra factor of 5 beyond the ones already counted. That gives you
100/25 = 4 more factors of 5 in 100!. To get a third factor of 5 from
a single number, it has to be a multiple of 125, and no number <= 100
is, so that is all. The answer is:

[100/5] + [100/5^2] + [100/5^3] + ...
= 20 + 4 + 0 + ...
= 24

Here [x] means the integer part of x, or the greatest integer not
exceeding x. (Why do we use this [x] instead of x?) All the terms from
some point on will be zero, so this is a finite sum.

Now for 2's (or any other prime number), the same analysis holds. The
answer for the highest power of 2 dividing 100! is

[100/2] + [100/2^2] + [100/2^3] + [100/2^4] + ...
= 50 + 25 + 12 + 6 + 3 + 1 + 0 + 0 + ...
= 97

The smaller of the two is 24, so the highest power of 10 dividing 100!
is 10^24, so 100! ends with 24 zeroes.

The same analysis works for any factorial n! and any prime p. The
highest power of p dividing n! is:

[n/p] + [n/p^2] + [n/p^3] + [n/p^4] + ...

-Doctor Rob,  The Math Forum
Check out our web site! http://mathforum.org/dr.math/
```
Associated Topics:
High School Number Theory

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search