How to find $40! \mod 5^{10}$? I'm trying to solve this congruence. I found that in $40!$ there are $9$ powers of $5$, but I'll need one more for $40!=0 \mod 5^{10}$. I thought about Euler's theorem or Wilson's, but couldn't find any correlation.

Because $5^9$ divides $40!$, we can use $ka \bmod kb =k(a \bmod b)\,$ [mod distributive law] to get $40! \bmod 5^{10} = 5^9\cdot(\frac{40!}{5^9} \bmod 5)$.  Hence we really only need to find the residue of $\frac {40!}{5^9} \bmod 5$. So separate $n \in 1 \cdots 40$ into two sets, those divisible by $5$ and those coprime to $5$:
The product of the $n$ coprime to $5$ is
$$  (1 \cdot 2 \cdot 3 \cdot 4)^8 \equiv 1 \pmod 5,$$
whereas the multiples of $5$ (with all the fives divided out) contribute
$$ 1 \cdot 2 \cdot 3 \cdot 4 \cdot 1 \cdot 1 \cdot 2 \cdot 3 \equiv (-1) \pmod 5.$$
Hence, we can write $$5^9 (\frac {40!}{5^9} \bmod 5) = 5^9 (1 \cdot -1 \bmod 5) = 5^9 \cdot 4$$
