Factorial Trailing zeroes intuition

100 Views Asked by At

I get that when we're trying to get the number of zeroes in 23!, we do 23/5 = 4 and we know there are 4 zeroes. My question is why only divide 23 by 5? What about 20, 15, 10, 5 all these numbers that are multiples of 5 and why does dividing 23 by 5 yield the number of 5's in the factorial? What's the mathematical intuition?

1

There are 1 best solutions below

8
On BEST ANSWER

Dividing $23$ by $5$ tells us how many multiples of $5$ there are less than (or equal to) $23$. That is how many multiples of $5$ occur in the product: $23\times 22\times \cdots \times 1$. Thus that product has $5^4$ as a factor. It also has $2^4$ as a factor, because $2$'s come much more frequently than $5$'s as we collect factors from $1$ to $23$. Thus the factorial has $10^4$ as a factor, hence $4$ zeros.

It's not just a matter of counting the number of $5$'s though. If we look at $25!$, it ends with $6$ zeros, because when we reach $25$, we add not one but two factors of $5$, because $25$ is $5^2$.