Euclidean Algorithm

Given two or more positive integers, the greatest common divisor (gcd), or highest common factor (hcf), is the largest positive integer that divides the numbers without a remainder.

If we are given the prime factorization of the numbers, finding the greatest common divisor is straightforward. Let A=p1q1p2q2pnqn A = p_1 ^{q_1} p_2 ^ {q_2} \ldots p_n^{q_n} and B=p1r1p2r2pnrn B= p_1 ^{r_1} p_2 ^ {r_2} \ldots p_n^{r_n}, where pip_i are positive prime integers and qi1 q_i \geq 1 . Then

gcd(A,B)=p1min(q1,r1)p2min(q2,r2)pnmin(qn,rn). \gcd{(A, B)} = p_1 ^ { \min(q_1, r_1)} p_2 ^ {\min (q_2, r_2)} \ldots p_n^{\min (q_n, r_n) }.

However, in general, factorizing numbers is a very difficult problem, so instead we use the Euclidean Algorithm.

Technique

To find the greatest common divisor using the Euclidean Algorithm, we perform long division several times. Starting with a pair of numbers (A,B) (A, B), we obtain A=Q×B+R A = Q\times B + R, where Q Q is the quotient and 0R<B 0 \leq R < B is the remainder. We then repeat the sequence with the pair (B,R) (B, R) .

As a concrete example, the following is the Euclidean Algorithm performed to calculate gcd(16457,1638) \gcd( 16457, 1638 ):

16457=1638×10+771638=77×21+2177=21×3+1421=14×1+714=7×2+0 \begin{aligned}16457 & = &1638 \times 10 & + &77 \\1638 & = &77 \times 21 & + &21\\ 77 & = & 21 \times 3 & + &14 \\21 & = & 14 \times 1 & + &7\\14 & = & 7 \times 2 & +& 0 \end{aligned}

The process stops since we reached 0, and we obtain

7=gcd(7,14)=gcd(14,21)=gcd(21,77)=gcd(77,1638)=gcd(1638,16457). 7 = \gcd (7, 14) = \gcd(14, 21) = \gcd (21, 77) = \gcd (77, 1638) = \gcd( 1638, 16457) .

Worked Examples

1. Show that if gcd(A,N)=1 \gcd(A,N)=1, then gcd(A,B)=gcd(A,BN) \gcd(A,B) = \gcd(A, BN).

Solution: Let P P be the set of primes that divide either A A or B B. Let P P' be the set of primes that divide either A A, B B or N N. Let ri r_i ' be the exponent of pi p_i ' in the term BN BN. If piA p_i ' \mid A, then pi∤N p_i \not | N, hence ri=ri r_i ' = r_i, so min(qi,ri)=min(qi,ri) \min(q_i, r_i ' ) = \min (q_i, r_i) . If pi∤A p_i ' \not | A, then qi=0 q_i=0, so min(qi,ri)=0=min(qi,ri) \min(q_i, r_i) = 0 = \min(q_i , r_i'). Hence, gcd(A,B)=gcd(A,BN) \gcd(A,B) = \gcd(A,BN).

 

2. (IMO '59) Prove that 21n+414n+3 \frac {21n+4} {14n+3} is irreducible for every natural number n n.

Solution: 21n+414n+3 \frac {21n+4} {14n+3} is irreducible if and only if the numerator and denominator have no common factor, i.e. their greatest common divisor is 1. Applying the Euclidean Algorithm,

21n+4=1×(14n+3)+7n+114n+3=2×(7n+1)+17n+1=(7n+1)×1+0. \begin{aligned} 21n+4 & = &1 \times (14n+3) & + &7n+1 \\ 14n+3 & = &2 \times (7n+1) & + &1\\ 7n+1 & = & (7n+1) \times 1 & + &0. \\ \end{aligned}

Hence, gcd(21n+4,14n+3)=1 \gcd(21n+4, 14n+3) =1, which shows that the fraction is irreducible.

Note by Calvin Lin
5 years, 6 months ago

No vote yet
1 vote

  Easy Math Editor

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

  • Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
  • Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
  • Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.
  • Stay on topic — we're all here to learn more about math and science, not to hear about your favorite get-rich-quick scheme or current world events.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold

- bulleted
- list

  • bulleted
  • list

1. numbered
2. list

  1. numbered
  2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1

paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
    # 4 spaces, and now they show
    # up as a code block.

    print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in \( ... \) or \[ ... \] to ensure proper formatting.
2 \times 3 2×3 2 \times 3
2^{34} 234 2^{34}
a_{i-1} ai1 a_{i-1}
\frac{2}{3} 23 \frac{2}{3}
\sqrt{2} 2 \sqrt{2}
\sum_{i=1}^3 i=13 \sum_{i=1}^3
\sin \theta sinθ \sin \theta
\boxed{123} 123 \boxed{123}

Comments

Sort by:

Top Newest

thanks ! a lot for posting such notes post some more on different topics

Achal Jain - 4 years, 3 months ago

Log in to reply

×

Problem Loading...

Note Loading...

Set Loading...