Sorry for a potentially very stupid question, but I've stuck in the very beginning of the book "On Quaternions and Octonions" by Conway and Smith with a proof of the well-known lemma:
If $p$ is a prime number, then $p$ divides a product if and only if it divides one of the factors.
Of course I can prove it in a classical way with the Bézout's identity. However, it looks like the authors are using a slightly different argument:
It will suffice to suppose that $p$ divides $ab$. Then the ideal of numbers of the form $mp+na$ must be a principal ideal whose generator $g$ must be a divisor of $p$, and so can be chosen to be $p$ or $1$.
The rest of the proof is clear, but I don't understand this argument: why the generator of this ideal must be a divisor of $p$?
Since $\Bbb Z$ is a principal ideal domain (as a Euclidean domain), and since the set $$I:=\{mp+na:m,n\in\Bbb Z\}$$ is an ideal, then $$I=\{kj:k\in\Bbb Z\}$$ for some positive $j\in\Bbb Z.$ Since $p=1p+0a\in I,$ then we have $p=kj$ for some $k\in\Bbb Z,$ so $j\mid p.$