n!

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

$\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 $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 $n!$ has 58 trailing zeros, what is n?

$\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 $i=1,2,...,j$

I don't know what to do next.

Actually you can write $\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 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 $n \in \{240,...,244\}$.
• Jun 19th 2010, 08:07 PM
simplependulum
Or let

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

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

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

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

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

$240 \leq n \leq 244$ .