0

What is the gcd of these two numbers? Is it possible to find the gcd? It should be $1$ when $n=1$, but $3$ when $n=5$.

$4n+1 = (3)(n+2) + (n-5)$ <-- This step is only valid when $n \geq 5$

How do I find the gcd?

Don Larynx
  • 4,703
  • 3
    $(4n+1, n+2) = (-7, n+2) = (n+2, 7)$, so if $7 | n + 2$ then the gcd is $7$, otherwise it is $1$. – Marco Jan 26 '15 at 18:17
  • 1
    The Eulclidean algorithm works for any pair integers, not only the nonnegative ones. Thus, it is irrelevant whether $n\geqslant 5$ or not. – Pedro Jan 26 '15 at 18:19
  • correction to question: when $n=5, \gcd(4n+1,n+2)=\gcd(21,7)=7$, not $3$ – Joffan Jan 26 '15 at 18:26
  • @PedroTamaroff: The remainder must be greater than or equal to zero. – Don Larynx Jan 26 '15 at 18:46

4 Answers4

4

Since $4\cdot(n+2)+(-1)\cdot(4n+1)=7$, we can say that either $\gcd(4n+1,n+2)=1$ or $\gcd(4n+1,n+2)=7$. Both cases can happen: for $n=1$ the gcd is $1$, for $n=5$ the gcd is $7$.

egreg
  • 238,574
3

Hint $\ $ By Euclid $\,\gcd(n\!+\!2,4\color{#c00}n\!+\!1) = \gcd(n\!+\!2,\, 4(\color{#c00}{-2})\!+\!1)\,$ since $\ \color{#c00}{n\equiv -2}\pmod{\!n\!+\!2}$


Similarly we have $\ \gcd(n\!-\!a,f(n)) = \gcd(n\!-\!a,f(a))\ $ for any polynomial $f(x)$ with integer coef's which follows by employing the following congruence rule (follow the link for a proof).

Polynomial Congruence Rule $\ $ If $\,f(x)\,$ is polynomial with integer coefficients then $\ A\equiv a\ \Rightarrow\ f(A)\equiv f(a)\,\pmod m.$

Note how simple the proof is when viewed this way - it amounts to simple polynomial evaluation.

This is a prototypical example of the power of congruence arithmetic. It allows us to replace obscure manipulation of divisibility relations by simpler congruence operations and equations, which allows reuse of our well-honed intuition on analogous integer arithmetic. The common structure in both arithmetics is abstracted out when one goes on to study (quotient) rings.

Bill Dubuque
  • 272,048
  • I don't understand why you took $n \equiv 2 (\mod n+2)$ – Don Larynx Jan 26 '15 at 18:48
  • @Don By Euclid we know $, \gcd(a,b) = \gcd(a,b')\ $ if $\ b'\equiv b\pmod a.\ $ Above is a special case of this, because $\ {\rm mod}\ n!+!2!:,\ n!+!2\equiv 0,\Rightarrow, n\equiv -2,\Rightarrow, 4n!+!1\equiv 4(-2)+1\equiv -7\ \ $ – Bill Dubuque Jan 26 '15 at 18:55
1

The gcd divides $4n +1 - 4 (n+2) = -7$, so it can only be $1$ or $7$. If $7$ divides $n+2$, then $n \equiv -2 \pmod{7}$, so $4 n + 1 \equiv -8 + 1 \equiv 0 \pmod{7}$.

Thus the gdc is $7$ when $n \equiv -2 \pmod{7}$, and $1$ otherwise.

1

If integer $d$ divides both $n+2,4n+1, d$ must divide $4(n+2)-(4n+1)=7$

Clearly $7|(n+2)\iff7|(4n+1)$

Now $7|(n+2)\iff n\equiv-2\pmod7\equiv5$