Given number of trailing zeros in n!, find out the possible values of n. It's quite straightforward to find out number of trailing zeros in n!.
But what if the reverse question is asked?

n! has 13 trailing zeros, what are the possible values of n ?

How should we approach the above question ?

Write $n$ in base $5$ as $n = a_0 + 5a_1 + 25a_2 + 125a_3 + \cdots$ where $0 \leq a_k \leq 4$. $$\left\lfloor \dfrac{n}5\right\rfloor = a_1 + 5a_2 + 25a_3 + \cdots$$
$$\left\lfloor \dfrac{n}{25}\right\rfloor = a_2 + 5a_3 + \cdots$$
$$\left\lfloor \dfrac{n}{125}\right\rfloor = a_3 + \cdots$$
Hence, $$\left\lfloor \dfrac{n}5\right\rfloor + \left\lfloor \dfrac{n}{25}\right\rfloor + \left\lfloor \dfrac{n}{125}\right\rfloor + \cdots = a_1 + 6 a_2 + 31 a_3 + \cdots$$
Note that the coefficients of the terms from $a_3$ are greater than $13$. Since the sum must give us $13$, we get that $a_k = 0$, for all $k \geq 3$. Hence, we need to find the number of integer solutions to $a_1 + 6a_2 =13$ with $0 \leq a_1,a_2 \leq 4$. The constraint $0 \leq a_1,a_2 \leq 4$ further implies that $a_2$ cannot be $0$ and $1$. Hence, $a_2 = 2$. This gives us $a_1 = 1$.
Hence, $n = a_0 + 5a_1 +25a_2 = a_0 + 5 \times 1 + 25 \times 2 = 55+a_0$ where $a_0 \in \{0,1,2,3,4\}$. Hence, the desired values of $n$ are $$\{55,56,57,58,59\}$$
The same idea in principle will work when the trailing number of zeros is any number not just $13$.
