Is it significant that factorials have more trailing zeros as they get higher?

314 Views Asked by At

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

2

There are 2 best solutions below

0
On

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.

2
On

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