I'm just starting to write proof and I was asked to prove the above statement. I came up with the following proof by contrapositive:
Assume $p$ does not divide $a$ or $p$ does not divide $b$, then $p$ does not divide $ab$.
Let $a=pk$ & $b=pm$ for some integers $k$ and $m$.
So, $ab=(pk)(pm)$, then $ab=p(km)$. This is a contradiction.
I'm not sure if that is correct proof. Any help is appreciated. Thank you.
The proof is not valid.
First, let's review the contrapositive statement:
Assume $p$ does not divide $a \color{red}{\text{ and }} p$ does not divide $b$, then $p$ does not divide $ab$.
In the very next line, we have assumed that $p$ doesn't divide $a$, hence we can't write $a=pk$.
One possible way to solve the problem is by prime factorization of $a$ and $b$.