Let $n$ be an integer greater than $3$. Find a formula for $\gcd(n, n + 3)$ for each of the cases :
$1)$ $n \equiv 0\mod 3$
$2)$ $n \equiv 1\mod 3$
$3)$ $n \equiv 2\mod 3$
Any help would be greatly appreciated.
Apply the Euclidean algorithm. $\gcd(n, n+3) = \gcd(3, n)$. What's $\gcd(3, n)$ in each of the three cases?
Suppose $d|n$ and $d|(n+3)$. Then $d|3 = (n+3)-n$. Thus $d=1,3$.
So the gcd of $n$ and $n+3$ is either $1$ or $3$.
Can you see what it must be for each case?