# Number of trailing zeroes in $$10^{n}!$$

Okay, this is something I've noticed. The number of trailing zeroes in

$$1!$$ is $$0$$.

$$10!$$ is $$2$$.

$$100!$$ is $$24$$.

$$1000!$$ is $$249$$.

$$10000!$$ is $$2499$$.

$$100000!$$ is $$24999$$.

Is there, like, a generalisation or a proof or something for this? And is this result, or observation, useful? Comment any of your thoughts you believe add to this.

Note by Omkar Kulkarni
3 years, 8 months ago

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$

Sort by:

Well, I can give you this formula ${ 10 }^{ n }!\Rightarrow \sum _{ k=1 }^{ \infty }{ \left\lfloor \frac { { 10 }^{ n } }{ 5^{ k } } \right\rfloor }$

And the pattern only continues until $$n$$ is $$5$$, beyond that, there will still be a long chain of $$9$$'s but it is not exactly as what you put here. For example, for $$n=200$$, number of trailing $$0$$'s is $$24999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999959$$

- 3 years, 8 months ago

Oh

- 3 years, 8 months ago

I can't spot a pattern in how close it is to what you conjectured (it always seems to be quite close though) but I found a reason why the number of trailing zeroes will tend to be very close to 10^n/4.

Clearly, the number of trailing zeroes is simply the exponent of the 5's in the prime factorization of (10^n)!. If we go by from 1 to 10^n in the expansion of (10^n)! (1234...10^n) and write down the exponent of the greatest power of 5 that divides each number, we notice that 4 in every 25 numbers in the series has a 1, 4 in every 125 has a two, and so on. This allows us to make the following approximation for the exponent of the 5's:

4/25 * 10^n +2 * 4/125 * 10^n... = 4 * 10^n * [1/25+2/125+3/625...]

We can evaluate [1/25+2/125+3/625...] pretty easily:

5S= [1/5+1/25...] + [1/25+1/125...]+...

5S=1/4 + 1/20 + 1/100...

S=1/16

Which shows that we'll get about 10^n/4 trailing zeroes. As n becomes larger, the first few terms will become more accurate (percentage wise) because the error is within a certain range. I'll give an example:

   Let's say I'm looking at the 4/25 * k term (where k! is the number you are trying to find the trailing zeroes for). If n is small, say 35, this term is 5.6 (when we wanted 6). If n is large, say 20,035, we get 3205.6 (when we wanted 3206). As you can see, adding 25's makes no difference to the error, but adding 1-24 does. This means that the error, percentage wise, becomes less as n becomes large! The same concept can be applied to the 4/125 * k  term, and the accuracy for each term goes up.


So for a large n, the result of the approximation becomes more accurate. Your observation was mostly true :)

- 3 years, 8 months ago

Perhaps we should notice that they are to do with 5. From 10/ 5 = 2, 1000/ 5 = 200, 10000/ 5 = 2000 and 100000/ 5 = 20000, the rough idea is there.

- 3 years, 8 months ago