Prove that, for all prime number $p$ and $a \in \mathbb{Z}$, $$a\mathbb{Z} \cap \mathbb{Z} \backslash p\mathbb{Z} \neq \varnothing \iff a\mathbb{Z}_{(p)}=\mathbb{Z}_{(p)}.$$
Note that $\mathbb{Z}_{(p)}=\{\frac{m}{n}:m,n \in \mathbb{Z}, n \not\in p\mathbb{Z}\}$.
This is maybe very easy but I'm not seeing how to solve it.
Some help here would be much appreciated.
$$\newcommand{\ZZ}{{\mathbb Z}}$$
Call $A = \ZZ_{(p)}$ and $S = \ZZ - p \ZZ$. It is $a \ZZ_{(p)} = \{ m/n \mid m,n \in \ZZ, p \nmid n, a \mid m\}$.
If $a \ZZ \cap S \neq \emptyset$ then $p \nmid n'$ for a certain $n'$ with $a \mid n'$. So $n'/1 \cdot 1/n' = 1$ in $A$ and therefore $a A = A$. The inverse $1/n'$ is well defined, as $p \nmid n'$.
Otherwise, if $a A = A$ then it is $n/m = 1$ for $a \mid n$ and $p \nmid m$. But this implies $s n = s m$ for an $s$ with $p \nmid s$. So $p \nmid n$ and $n$ is our sought element in $S \cap a \ZZ$.