Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I first learned about factorials in grade school I quickly became interested in the idea and did a lot of playing with them. I noticed, though, that as the factorials got higher and higher they gained more and more trailing zeros.

5!  has 1 trailing zero  and =                       120
10! has 2 trailing zeros and =                 3,628,800
15! has 3 trailing zeros and =         1,307,674,368,000
20! has 4 trailing zeros and = 2,432,902,008,176,640,000

I always wondered if this meant something or perhaps proves a certain theorem. Does it?

Full Precision Calc

share|cite|improve this question
The number of trailing zeros in $n!$ does grow as $n$ grows, but not exponentially. It is almost linear growth, close to $n/4$. – alex.jordan Feb 25 '13 at 23:18
Also, 50! should only have 12 trailing zeros. Be careful what software you are using to compute 50!. Software that is too simple will only be able to keep track of so many digits, and then replace subsequent ones with all zeros. – alex.jordan Feb 25 '13 at 23:22
@alex.jordan Yep That is what happened. I was using a double precision data type in a C# app I just made not realizing that the upper limit for that is well below the value for 50! This is what also made me think that it was exponential. – fredsbend Feb 25 '13 at 23:27

If $p$ is a prime, then $n!$ is a multiple of $p^k$ (but not $p^{k+1}$) where $$\tag1 k=\left\lfloor \frac np\right\rfloor+\left\lfloor \frac n{p^2}\right\rfloor+\left\lfloor \frac n{p^3}\right\rfloor+\ldots$$ and $\lfloor x\rfloor$ is the largest integer $\le x$. This is so because each summand counts the factors among $1,2,\ldots ,n$ that are multiples of $p$, of $p^2$, of $p^3$ and so on.

If we let $p=2$ in $(1)$, the $k$ we obtain will always be at least as big as when we let $p=5$. Therefore the highest power of $10=2\cdot 5$ dividing $n!$ (i.e. the number of trailing zeroes) is given by $(1)$ with $p=5$. That is: The number of zeroes grows by one at every multiple of $5$, by two at every multiple of $25$, by three at every multiple of $125$ and so on. Note however, that the growth of the number of zeroes is not exponentially. In fact, $$\left\lfloor \frac np\right\rfloor+\left\lfloor \frac n{p^2}\right\rfloor+\left\lfloor \frac n{p^3}\right\rfloor+\ldots< \frac np+\frac n{p^2}+\frac n{p^3}+\ldots =\frac{n}{p-1},$$ so the number of zeroes is linearly bounded and always $< \frac n4$.

By the way, $50!$ has only $\left\lfloor \frac{50}5\right\rfloor +\left\lfloor \frac{50}{25}\right\rfloor +\left\lfloor \frac{50}{125}\right\rfloor +\ldots = 10+2+0+0+\ldots = 12$ trailing zeroes

share|cite|improve this answer
Yes, I was using a data type that cannot calculate that high which is way I said 50 trailing 0's and exponential. I have since found a full precision calc. – fredsbend Feb 25 '13 at 23:32
But this does not answer my question. I see the formula and that now I can predict the trailing zeros without doing the factorial, but I asked if this actually means anything or proves a theorem. – fredsbend Feb 25 '13 at 23:35

Every time you pass a multiple of 10 (or something 5 mod 10) you will accumulate another 0

For example 10! has two trailing zeros, one from multiplying by 10 and the other from multiplying by 5 and 2.

So it makes sense that as you get much higher the number of accumulated zeroes should increase.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.