# n!

• Jun 19th 2010, 10:13 AM
dwsmith
n!
If $\displaystyle n!$ has 58 trailing zeros, what is n?

$\displaystyle \left \lfloor \frac{n}{5} \right \rfloor + \left \lfloor \frac{n}{25} \right \rfloor + \dots + \left \lfloor \frac{n}{5^i} \right \rfloor=58$ where $\displaystyle i=1,2,...,j$

I don't know what to do next.
• Jun 19th 2010, 10:29 AM
undefined
Quote:

Originally Posted by dwsmith
If $\displaystyle n!$ has 58 trailing zeros, what is n?

$\displaystyle \left \lfloor \frac{n}{5} \right \rfloor + \left \lfloor \frac{n}{25} \right \rfloor + \dots + \left \lfloor \frac{n}{5^i} \right \rfloor=58$ where $\displaystyle i=1,2,...,j$

I don't know what to do next.

Actually you can write $\displaystyle \displaystyle 58 = \left \lfloor \frac{n}{5} \right \rfloor + \left \lfloor \frac{n}{25} \right \rfloor + \dots = \sum_{i=1}^\infty \left \lfloor \frac{n}{5^i} \right \rfloor$ since the terms eventually all become 0.

We can get an immediate upper bound: if n=59*5, then the first term will be greater than 58. Since 59*5 - 1 < 625, clearly we have just the first three terms:

$\displaystyle \displaystyle 58 = \left \lfloor \frac{n}{5} \right \rfloor + \left \lfloor \frac{n}{25} \right \rfloor + \left \lfloor \frac{n}{125} \right \rfloor$

This is easy to play around with; 58/5 is about 12, so as an estimate we can subtract about 10*5 from our upper bound to get 59*5-51 = 244. Plugging in results in 48 + 9 + 1 = 58, as desired. So $\displaystyle n \in \{240,...,244\}$.
• Jun 19th 2010, 08:07 PM
simplependulum
Or let

$\displaystyle n = 125a + 25b + 5c + d$ as a representation in base 5 , since it does not exceed $\displaystyle 625$

Therefore , $\displaystyle [ \frac{n}{5} ] = 25a + 5b + c ~ [ \frac{n}{25} ] = 5a + b ~,~ [ \frac{n}{125} ] = a$

$\displaystyle 25a + 5b + c + 5a + b + a = 31a + 6b + c = 58$

$\displaystyle a = 1 ~,~ b = 4 ~,~ c =3$ and $\displaystyle d$ ranges from $\displaystyle 0$ to $\displaystyle 4$ .

$\displaystyle 125(1) + 25(4) + 5(3) + 0 \leq n \leq 125(1) + 25(4) + 5(3) + 4$

$\displaystyle 240 \leq n \leq 244$ .