# Given a positive integer n, if for all integers a and b, n|ab implies n|a or n|b, then n is prime.

I'm new here and I'm stuck on a problem with my homework. I know that if ab/n=m, a/n=p, and b/n=q where m, p and are integers and I have to show that n can only be divided by one and itself but I'm not sure how to get there. Any help will be appreciated. Thanks

• I suggest you improve your question. Also, you're missing some text in "where m, p and are integers". Oct 3 '13 at 2:39
• Do you intend that $p$ and $q$ are primes? Anyway, the title of your question is exactly the correct definition of a prime number (in ${Z}$). Oct 3 '13 at 10:14

Hint: If $n$ is not prime, it has two non-trivial factors $a$ and $b$ such that $ab = n$ but $1 < a, b < n$. Now proceed by contrapositive.