2

Prove that $\gcd(n,n+2)=1$ if $n$ is odd and $\gcd(n,n+2)=2$ if $n$ is even.

My Try:

So, first I took some $k$ to be even then $k$ is not the common divisor of $n$ and $n+2$.

If $k|n$ and $k|n+2$ as $k$ is even $\implies 2|k$

$2|n$ and $2|n+2$ is not possible.

Is my above attempt correct? Are there any better ways to prove the above?

  • When $d$ divides $a$ we can express it as $a=xd$ for some integer $x$. For another $b$ with $d$ again as a divisor it will be $b=yd$. Can you say anything about the difference $a-b$? – P Vanchinathan Dec 14 '18 at 03:07
  • What are you allowed to use/assume? If you can assume gcd(a, b) = gcd (a, a-b) then it's as trivial as saying gcd(n, n+2) = gcd (2, n) from which the result follows almost immediately. – Deepak Dec 14 '18 at 03:45

4 Answers4

3

An easy way to prove it would be:

Part 1)

Suppose $n=2k+1$ since $n$ is odd, therefore $n+2=2k+3$ Now if we want to find their gcd we would get that $$\gcd(n,n+2)=\gcd(2k+1,2k+3)=\gcd(2k+1,2k+3-(2k+1))=\gcd(2k+1,2)$$ But $2k+1$ is odd while $2$ is even, therefore their gcd will have to be $1$. Meaning that $\gcd(n, n+2)=1$ if $n$ is odd.

Part 2)

Now we can suppose $n=2k$, therefore $n+2=2k+2$ Now if we want to find their gcd we would get that $$\gcd(n,n+2)=\gcd(2k,2k+2)=\gcd(2k,2k+2-(2k))=\gcd(2k,2)$$ Now since $2k$ is even, that means $2$ can be a common divisor and it would be the largest as we know that $\gcd(a, b)\le a, b$. This gives us that $\gcd(n, n+2)=2$ if $n$ is even.

user587054
  • 1,261
  • 1
    This is basically using the idea in my comment, except more verbosely. Again, the question is: what can be assumed in solving this question? – Deepak Dec 14 '18 at 04:24
1

I did not quite understand your attempted solution.

So, first I took some $k$ to be even then $k$ is not the common divisor of $n$ and $n+2$.

Are you saying that if $k$ is even, then $k$ is not the common divisor of $n$ and $n+2$? That won't be true unless $n$ is odd. Maybe you meant to say "We consider the case that $n$ is odd first."?

Additionally, this statement requires justification. Did you mean to say, "First I will show that for any even number $k$, $k$ is not the common divisor of $n$ and $n+2$."?

If $k|n$ and $k|n+2$ as $k$ is even $\implies 2|k$

I think you meant to say: "Since $k$ is even, $2 \mid k$. Additionally, suppose towards contradiction that $k \mid n$ and $k \mid n+2$ (we will show that this is impossible). Then also $2 \mid n$ and $2 \mid n+2$."

$2|n$ and $2|n+2$ is not possible.

I would not say it's "not possible". Do you mean that it contradicts the fact that $n$ is odd, which we assumed earlier?

If you're doing a proof by contradiction, always say so, and end with a contradiction!

Is my above attempt correct? Are there any better ways to prove the above?

There is a problem with your proof. First, it seems like you only considered the case where $n$ is odd. Second, it seems like you just showed that the common divisor of $n$ and $n+2$ cannot be even. But, what if the common divisor of $n$ and $n+2$ is $3$? What if it is $5$? You need to show that it is $1$, not just that it is not even.

I would suggest you try to write down your ideas more carefully. Once you can write down the ideas carefully, it may help you write a correct solution. Do not allow yourself to make any jumps in the argument that are not perfectly logical and correct.

0

There are some areas left vague, the part proving $k$ is not a greatest common divisor of $n$ and $n+2$ (actually this is false, let $k=2$) and showing $2|n$ and $2|n+2$ is impossible.

Part 1: you need to add that $k>2$ or else the statement is false, and show why the statement is true for $k>2$. You can show that for $n\equiv 0\mod k$ and $n+2\equiv 0\mod k$, we can convert the statements to $0\equiv -n\mod k$ and $2\equiv -n\mod k$ and since $-n\equiv 0\mod k$, the statements become $2\equiv0\mod k$ (we can ignore $0\equiv0\mod k$ since that is true for all $k$ and is redundant). We can see that the above statement is not true for $k>2$, so the statement is false.

Part 2: Let us define $m$ such that $m=n-1$ if $n$ is odd. Since $2|m$, $n\equiv1\mod2$ and $n+2\equiv3\equiv1\mod2$. So $2\nmid n$ and $2\nmid n+2$ for odd $n$. Since Part $1$, when generalized to all values of $k$, involves $n\equiv0\mod2$, it shows $n+2\equiv0\mod2$.

Kyan Cheung
  • 3,324
0

Well, what I did (Guided by an idea took from Ferland's book) is:

We know that:

n = ka  and n+2 =kb

We can rewrite this as:

2 = (n+2)-n
2 = kb - ka
2 = k(b-a)

And the last statement is telling us that:k|2 and k<=2, k can be 2 or 1 I don't know if it's correct, but does make sense to me