Hello!

First notice that if

$\displaystyle q | ab$ implies $\displaystyle q | a$ or $\displaystyle q | b$ for all $\displaystyle a,b \in \Bbb Z, $

then q must be a prime. Indeed if we had $\displaystyle q=mn$ with neither $\displaystyle m$ nor $\displaystyle n$ a unit, then $\displaystyle q | mn$ but $\displaystyle q$ would certainly divide neither m or n.

Now to show $\displaystyle \sqrt{p}$ is irrational, suppose $\displaystyle \sqrt{p}=\frac{a}{b}$. Then $\displaystyle pb^2=a^2$. The right-hand side is a square, hence all prime powers in the factorization of $\displaystyle pb^2$ should have even exponent; but the exponent of p is odd. Hence there exist no such $\displaystyle a,b$.