$\mathrm{gcd}(n,n+2)=2$

113 Views Asked by At

I have a question:

For what positive integers $n$ is $\mathrm{gcd}(n,n+2)=2$. Prove your claim.

Is this correct?:

If $n$ is odd then both $n$ and $n+2$ are odd so the gcd cannot be $2$. So assume that $n$ is even that is $n=2k,\quad k\in\mathbb{N}$ since $n>0$. Using the Euclidean algorithm we get $$ n+2=1\cdot n+2 $$ $$ n=2\cdot k+0 $$ and the last nonzero remainder is $2$ so $(n,n+2)=2$ for all positive even $n$.

3

There are 3 best solutions below

0
On

Looks solid to me. It's probably also the shortest way to go.


An alternative is to say that $d$ is the common divisor of $n$ and $n+2$, meaning that $n=k\cdot d$ and $n+2=l\cdot d$ for some $k,l$.

Then, $n+2-n = l\cdot d - k\cdot d$ simplifies to $2=(l-k)\cdot d$.

This is only possible if either $d\in \{1,2\}$, proving the only common divisors of $n, n+2$ can be $1$ and $2$.

The, because $n$ and $n+2$ are both even, you can conclude that their greatest common divisor is $2$.

0
On

Note $\gcd(m,m+1)=1, m\in N.$

Multiply it by $2:$ $$\gcd(2m,2m+2)=2.$$

0
On

Note that using division algorithm $$(n,n+2)=(n,n+2-n)=(n,2)=$$

$1-$ If $n$ is odd.

$2-$ If $n$ is even.