GCD with Prime
From ProofWiki
Theorem
Let $p$ be a prime number.
Then:
- $\forall n \in \Z: \gcd \left\{{n, p}\right\} = \begin{cases} p & : p \backslash n \\ 1 & : p \nmid n \end{cases}$
Proof
The only divisors of $p$ are $1$ and $p$ itself by definition.
$\gcd \left\{{n, p}\right\} = p$ precisely when $p$ divides $n$.
Hence the result.
$\blacksquare$