Length of Reciprocal of Product of Powers of 2 and 5

Theorem
Let $n \in \Z$ be an integer.

Let $\dfrac 1 n$, when expressed as a decimal expansion, terminate after $m$ digits.

Then $n$ is of the form $2^p 5^q$, where $m$ is the greater of $p$ and $q$.