Let $m$ be a natural number larger than 1, and suppose that $m$ satisfies the following property:
For any integers $a$ and $b$, if $m$ divides $ab$, then $m$ divides either $a$ or $b$ (or both).
Show that $m$ must be prime.
I think we should solve this question with a proof by contradiction. So, suppose $m$ is not prime, therefore $\exists$$k$ $\in$ $\mathbb{Z}$ such that $k|m$. We also notice that the property $m$ satisfies is Euclid's Lemma, and from it we can conclude $gcd(a,m) = m$ and $gcd(b,m) = m$ depending on if $m|a$ or $m|b$ or both.
Now from here I don't know how I should proceed further. In fact, I'm not sure if I'm looking in the right direction, so your help would be appreciated.