0% found this document useful (0 votes)
2 views

Number Theory Topic #05 Euclidean Algorithm - Study Notes v1.00

The document discusses the properties and methods for calculating the greatest common divisor (gcd) of two integers, focusing on non-negative integers. It introduces the Euclidean algorithm as an efficient method for finding the gcd by repeatedly applying the division algorithm until a remainder of zero is reached. Additionally, it includes proofs and examples to illustrate the concepts and theorems related to gcd.

Uploaded by

vishwajitmisal0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Number Theory Topic #05 Euclidean Algorithm - Study Notes v1.00

The document discusses the properties and methods for calculating the greatest common divisor (gcd) of two integers, focusing on non-negative integers. It introduces the Euclidean algorithm as an efficient method for finding the gcd by repeatedly applying the division algorithm until a remainder of zero is reached. Additionally, it includes proofs and examples to illustrate the concepts and theorems related to gcd.

Uploaded by

vishwajitmisal0
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Preliminary Observations

1. For any integers a and b, not both zero,

 gcd(a, b) = gcd(b, a)
 gcd(a, b) = gcd(a, –b) = gcd(–a, b) = gcd(–a, –b) = gcd(|a|, |b|)

Hence if either a or b (or both) are negative integers, we can simply replace them by their positive
counterparts in order to find their greatest common divisor.

Therefore we will concern ourselves with the gcd of only non-negative integers a and b, for our further
study.

2. For any integer a > 0,

 gcd(a, a) = a
 gcd(a, 1) = 1
 gcd(a, 0) = a

The last point above tells us that, if either a or b (but not both) is zero, then finding their gcd is
extremely easy: it is simply equal to the other (positive) integer.

Therefore, we need no longer deal with this trivial case of zero integers too, while studying gcd.

In other words, we can limit ourselves to the gcd of only positive integers a and b, for our further study.

3. Let a and b be any positive integers. If b ∣ a, then gcd(a, b) = b.

Methods to find GCD of two positive integers a and b

1. List all positive divisors of each of the two integers and choose the largest divisor that is common to
both integers.

2. Write down the prime factorization for each of the two integers a and b.
a2 a3 a5 a7 a11 b2 b3 b5 b7 b11
Suppose a = 2 ×3 ×5 ×7 × 11 × . . . and b = 2 ×3 ×5 ×7 × 11 ×...

Note that all exponents above are non-negative integers. If a prime p does not divide a (or b) then the
corresponding exponent ap (or bp) is zero.
min(a2, b2) min(a3, b3) min(a5, b5) min(a7, b7) min(a11, b11)
Then gcd(a, b) = 2 ×3 ×5 ×7 × 11 ×...

Here min(r, s) stands for the minimum of r and s i.e. if r ≤ s, min(r, s) = r; if r > s, min(r, s) = s.

3. List all linear combinations ax + by for various integers x and y, such that ax + by > 0. Choose the
smallest element from this list.

While all these methods are correct, they are cumbersome and impractical for large integers a and b.
For example, try to find gcd(517031, 384529) or gcd(541109, 265927), using any of these methods.
Theorem: If a and b are integers where b > 0, then

gcd(a, b) = gcd(b, r), where r = Remb(a) i.e. r is the remainder of a wrt the divisor b.

Proof 1

Using the division algorithm, we know that there exist integers q (quotient) and r (remainder) such that:

a = qb + r, 0≤r<b … (1)

Let d = gcd(a, b).

What does that mean? It means two things:

(i) d ∣ a and d ∣ b. … (2)

(ii) If c ∣ a and c ∣ b, then c ≤ d. … (3)

We wish to show that the same d is also the gcd of b and r. In other words, we wish to show both of the
following results:

R1. d is a common divisor of b and r.

R2. Any common divisor of b and r is less than or equal to d.

From (2), we have:

d ∣ a and d ∣ b
If a ∣ b and a ∣ c, then a ∣ mb + nc for any integers m and n
 d ∣ 1 × a + (–q) × b {using divisibility property P8}

 d∣r {using (1) to write r = a + (–qb)}

Thus we see that d, which divides both a and b, also divides r i.e. d is a common divisor of b and r. Hence
we have established that R1 is true.

Let f be any arbitrary common divisor of b and r. Hence, it follows that

f ∣ b and f ∣ r

 f∣q×b+1×r {using divisibility property P8}

 f∣a {using (1)}

Thus we see that f, which divides both b and r, also divides a. Hence f is also a common divisor of a and
b.

Since d is the greatest common divisor of a and b, every common divisor of a and b must be less than or
equal to d.

We have already shown that f is a common divisor of a and b. Hence we must have:

f ≤ d.

Thus if f is any common divisor of b and r, f is less than or equal to d.


Hence we have established that R2 is true.

Therefore, by definition of gcd, d = gcd(b, r).

In other words, gcd(a, b) = gcd(b, r) where r is the remainder of a wrt b.

Q.E.D.

Proof 2

Using the division algorithm, we know that there exist integers q (quotient) and r (remainder) such that:

a = qb + r, 0≤r<b … (4)

Let d = gcd(a, b) and g = gcd(b, r).

Since d = gcd(a, b), it follows that

d ∣ a and d ∣ b
If a ∣ b and a ∣ c, then a ∣ mb + nc for any integers m and n
 d ∣ 1 × a + (–q) × b {using divisibility property P8}

 d∣r {using (4) to write r = a + (–qb)}

Thus we see that d, which divides both a and b, also divides r i.e. d is a common divisor of b and r.

Now, every common divisor of b and r is less than or equal to g = gcd(b, r).

Since we have shown that d is a common divisor of b and r, we must have

d≤g … (5)

Similarly, since g = gcd(b, r), it follows that

g ∣ b and g ∣ r

 g∣q×b+1×r {using divisibility property P8}

 g∣a {using (4)}

Thus we see that g, which divides both b and r, also divides a i.e. g is a common divisor of a and b.

Now, every common divisor of a and b is less than or equal to d = gcd(a, b).

Since we have shown that g is a common divisor of a and b, we must have

g≤d … (6)

Therefore, the only way that both inequalities (5) and (6) can be satisfied, is to have:

d=g

 gcd(a, b) = gcd(b, r) where r is the remainder of a wrt b.

Q.E.D.
Now, note that since r is the remainder of a wrt b, r is strictly less than b. Thus, effectively this theorem
tells us that finding the gcd of two positive integers a and b (a ≥ b) is equivalent to finding the gcd of the
two smaller integers b and r.

Can we not apply the same result once again to now find gcd(b, r)? If the conditions of the theorem are
satisfied, then surely we can.

Suppose that the theorem conditions are indeed satisfied. If we now once again use the division
algorithm to write:

b = q1r + r1, 0 ≤ r1 < r

then, applying the theorem once again gives us:

gcd(b, r) = gcd(r, r1)

Note that r1 < r < b.

But then, can we not keep applying the theorem result successively - so that at each successive step we
get smaller and smaller non-negative integers?

Can we keep applying this process indefinitely? When would we stop the process? Let us attempt to see
this in actual action in an example and check.

Example 1

Find the GCD of 1521 and 624.

Solution

Using the division algorithm, we can write:

1521 = 2 × 624 + 273

Hence, applying the theorem result, we get:

gcd(1521, 624) = gcd(624, 273) … (1)

Once again, using the division algorithm,

624 = 2 × 273 + 78

Once again, applying the theorem result:

gcd(624, 273) = gcd(273, 78) … (2)

Once again, using the division algorithm,

273 = 3 × 78 + 39

Once again, applying the theorem result:

gcd(273, 78) = gcd(78, 39) … (3)


Once again, using the division algorithm,

78 = 2 × 39 + 0

Once again, applying the theorem result:

gcd(78, 39) = gcd(39, 0) … (4)

Now, we know that for any positive integer a: gcd(a, 0) = a.

Hence gcd(39, 0) = 39. … (5)

Combining (1), (2), (3), (4) and (5), we get:

gcd(1521, 624) = gcd(624, 273) = gcd(273, 78) = gcd(78, 39) = gcd(39, 0) = 39.

Note: Since a zero remainder is obtained in step (4), we anyway cannot use the division algorithm once
again – with this zero remainder as the new divisor.

Thus, we see that our theorem result has actually turned out to be very powerful.

To find the gcd of any two positive integers a and b (a ≥ b), we keep using the division algorithm and the
theorem result successively, so that at each step we deal with smaller integers than in the previous step.

How do we know that we will always have smaller integers at the end of any step, as compared to the
previous step?

This is guaranteed, because the new integer introduced at each step is always the remainder – and the
remainder is always a non-negative number that is strictly smaller than the divisor.

How long do we keep applying this process?

We keep doing this until we get a remainder of 0. When we get a remainder of zero at any step, the
divisor used in that step is the gcd of the original pair of numbers (and it is the gcd of each successive
pair of numbers that we generate, as well).

How do we know that we will surely get a remainder of zero at some step?

At each step, the remainder is strictly smaller than the remainder at the previous step. Thus the
successive remainders are strictly decreasing. Now remainders, by definition, are always non-negative;
i.e. they have a lower bound of zero. Hence the sequence of forever strictly decreasing remainders must
necessarily result in a zero remainder at some step.

Thus our theorem result helps us devise an efficient algorithm to find the gcd of two integers a and b,
not both zero. This algorithm is called the Euclidean algorithm and is described on the next page.
We know that gcd(a, b) = gcd(|a|, |b|). Hence we can focus solely on non-negative integers a and b.

Furthermore for a > 0, gcd(a, 0) and gcd(0, a) are both trivially equal to a. Hence we can consider only
positive integers a and b.

Finally we also know that gcd(a, b) = gcd(b, a).

Hence if a and b are two integers whose greatest common divisor is desired, we can safely assume,
without any loss of generality, that a ≥ b > 0.

Euclidean Algorithm to find gcd(a, b)

Assume that a ≥ b > 0. We apply the division algorithm to a and b to get

a = q1b + r1, 0 ≤ r1 < b

If r1 = 0, then b ∣ a and gcd(a, b) = b. If r1 ≠ 0, we apply the division algorithm to b and r1, to produce
integers q2 and r2 satisfying

b = q2r1 + r2 , 0 ≤ r2 < r1

If r2 = 0, we stop; otherwise we proceed as before to obtain

r1 = q3r2 + r3, 0 ≤ r3 < r2

This division process continues until some zero remainder appears, say, at the (n + 1)th stage where the
division algorithm is applied to rn-1 and rn. Note that a zero remainder is bound to occur sooner or later
because the successive remainders r1, r2, r3, . . . are strictly decreasing (b > r1 > r2 > r3 > . . .) and always
non-negative. Hence a zero remainder must occur after at the most b steps.

As a result, we get the following set of equations:

a = q1b + r1, 0 < r1 < b

b = q2r1 + r2 , 0 < r2 < r1

r1 = q3r2 + r3, 0 < r3 < r2


rn-2 = qnrn-1 + rn, 0 < rn < rn-1

rn-1 = qn+1rn+ 0

Using the Theorem that we proved earlier, we can now assert:

gcd(a, b) = gcd(b, r1) = gcd(r1, r2) = . . . = gcd(rn-2, rn-1) = gcd(rn-1, rn) = gcd(rn, 0) = rn

Thus gcd(a, b) = rn, the divisor in the step in which we get a zero remainder.
Example 2

Find gcd(9964, 2703), using the Euclidean algorithm.

Solution

9964 = 3 × 2703 + 1855

2703 = 1 × 1855 + 848

1855 = 2 × 848 + 159

848 = 5 × 159 + 53

159 = 3 × 53 + 0

Hence gcd(9964, 2703) = 53.

Theorem:

If k is a positive integer, then gcd(ka, kb) = k × gcd(a, b).

Proof

We can again safely assume, without any loss of generality, that a ≥ b > 0.

If each of the equations appearing in the Euclidean Algorithm for a and b (see the previous page) is
multiplied by the given positive integer k, we obtain:

ak = q1(bk) + r1k, 0 < r1k < bk

bk = q2(r1k) + r2k, 0 < r2k < r1k

r1k = q3(r2k) + r3k, 0 < r3k < r2k


rn-2k = qn(rn-1k) + rnk, 0 < rnk < rn-1k

rn-1k = qn+1(rnk) + 0

However, this is clearly the Euclidean Algorithm applied to the integers ak and bk.

Hence their greatest common divisor is the divisor rnk in the last step. Note that, on the previous page,
we had obtained gcd(a, b) = rn.

Thus, gcd(ka, kb) = rnk = k × gcd(a, b).

Corollary: For any integer k ≠ 0, gcd(ka, kb) = |k| × gcd(a, b).

Proof
If k > 0, |k| = k; hence for k > 0, we need to show that gcd(ka, kb) = k × gcd(a, b). The above theorem has
already proved this result.

If k < 0, –k = |k| > 0. Hence we can write:

gcd(ka, kb) = gcd(–ka, –kb) {∵ gcd(m, n) = gcd(–m, –n)}

= gcd(|k|a, |k|b) {since k < 0, –k = |k|}

= |k| × gcd(a, b) {|k| > 0, hence using above theorem}

Thus, in either case i.e. whether k is positive or negative, we obtain the desired result.

Example: gcd(60, 80) = 5 × gcd(12, 16) = 5 × 4 × gcd(3, 4) =5×4×1 = 20.

Theorem: If a and b are integers not both zero, then for any integer n

gcd(a, b) = gcd(a + nb, b)

Proof

Let n be any particular but arbitrarily chosen integer.

Let f be any arbitrary common divisor of a and b i.e. f∣a and f ∣ b.

Then, clearly, we must have: f ∣ 1 × a + n × b  f ∣ a + nb.

Thus f is a common divisor of a + nb and b.

Hence we have shown that every common divisor of a and b is a common divisor of a + nb and b. … (1)

Now, let g be any arbitrary common divisor of a + nb and b i.e. g ∣ a + nb and g ∣ b.

Then, clearly, we must have: g ∣ 1 × (a + nb) + (–n) × b  g ∣ a.

Thus g is a common divisor of a and b.

Hence we have shown that every common divisor of a + nb and b is a common divisor of a and b. … (2)

From (1) and (2), it follows that the set of common divisors of a and b is identical to the set of common
divisors of a + nb and b.

Hence the greatest element of each of these respective identical sets must obviously be equal.

By definition, the greatest element of the set of common divisors of a and b is equal to gcd(a, b) – while
the greatest element of the set of common divisors of a + nb and b is equal to gcd(a + nb, b).

Thus we have shown that for any integer n, gcd(a, b) = gcd(a + nb, b).

Alternative methods for proof


We have proved the first theorem at the start of this document, using two other methods. The same
reasoning/approach used in each of those two methods can be used here as well.

In one method we can let d = gcd(a, b) and show that the same d is also the gcd of a + nb and b.

In the other method, we can let d = gcd(a, b) and g = gcd(a + nb, b) and then show that d = g.

Corollary 1: If a and b are integers not both zero, then for any integer n, gcd(a, b) = gcd(a, b + na).

Proof

gcd(a, b) = gcd(b, a)

= gcd(b + na, a) {using the above theorem}

= gcd(a, b + na).

Corollary 2: If a and b are integers not both zero, then

gcd(a, b) = gcd(a + b, b) = gcd(a – b, b) = gcd(a, b + a) = gcd(a, b – a).

Proof

This follows directly from the above theorem (by using n = ±1) and from corollary 1 (by using n = ±1).

Corollary 3: If a and b are integers not both zero such that a = kb + m for some integers k and m, then

gcd(a, b) = gcd(b, m).

Proof

We are given that: a = kb + m. … (1)

Using the above theorem with n = –k, we get:

gcd(a, b) = gcd(a + (–kb), b)

= gcd(m, b) {using (1) to write m = a + (–kb)}

= gcd(b, m)

Note: Corollary 3 thus shows us that the result proved in the very first theorem at the start of this
document, is not restricted to the remainder r obtained from the division of a with respect to b.

Example 2 (re-visited)

Find gcd(9964, 2703), using the Euclidean algorithm.

Solution

We can exploit the above corollary 3 here. As compared to the previous solution (which required 5
steps), it is more efficient to write the steps as follows.
9964 = 4 × 2703 – 848 {note how this step differs from that in the previous solution}

2703 = 3 × 848 + 159

848 = 5 × 159 + 53

159 = 3 × 53 + 0

Hence gcd(9964, 2703) = 53.

Note: The number of steps in the Euclidean Algorithm can usually be reduced by selecting “remainders”
rk+1 such that |rk+1| ≤ rk/2 i.e. by choosing a “remainder” (in any step) whose absolute value is less than
or equal to half the divisor used in that step. In other words, working with least absolute “remainders”
in the divisions, sometimes leads to the answer in fewer steps.

Additional Note: In such a scheme of using least absolute “remainders”, even if we opt for a “negative
remainder” at some step, we should take the absolute value of such a negative remainder as the divisor
in the next step. For example, in the more efficient example above, we selected –848 as the remainder
in the first step; but the divisor in the second step was taken as 848 (and not –848).

Interested readers might wish to attempt to prove that the number of steps required in the Euclidean
Algorithm is at most five times the number of decimal digits in the smaller integer.

Hint: Consider the Fibonacci sequence defined recursively by F1 = 1, F2 = 1 and Fn = Fn–1 + Fn–2 for all n > 2.

Assuming that a zero remainder appears at the n+1th step of the Euclidean Algorithm, start with the last
non-zero remainder rn and show that rn ≥ F2. Using this, work back iteratively to show that:

rn–1 ≥ F3 , rn–2 ≥ F4 , ... rn–k ≥ Fk+2 , ... r1 ≥ Fn+1 , b ≥ Fn+2

Finally, show that Fn+5 has at least one more decimal digit than Fn , for all n > 1.

To compute gcd(a, b) using the Euclidean Algorithm (a ≥ b > 0), as seen previously, we get the following
set of equations (writing these equations once again for ease of reference):

a = q1b + r1, 0 < r1 < b

b = q2r1 + r2 , 0 < r2 < r1

r1 = q3r2 + r3, 0 < r3 < r2


rn-3 = qn-1rn-2 + rn-1, 0 < rn-1 < rn-2

rn-2 = qnrn-1 + rn, 0 < rn < rn-1

rn-1 = qn+1rn+ 0
Euclidean Algorithm and Bézout's Identity

Bézout's Identity tells us that gcd(a, b) can be expressed in the form ax + by, but the proof of that
theorem does not inform us how exactly to determine the integers x and y.

In order to determine the integers x and y, we can fall back on the Euclidean algorithm.

The second-last equation arising from the algorithm is:

rn-2 = qnrn-1 + rn

This allows us to write the gcd rn as a linear combination of rn-1 and rn-2 in the following manner:

rn = (– qn)rn-1 + (1)rn-2 … (1)

The preceding equation in the algorithm is:

rn-3 = qn-1rn-2 + rn-1

 rn-1 = rn-3 – qn-1rn-2 … (2)

Substituting the value of rn-1 from (2) in (1), we get:

rn = – qn(rn-3 – qn-1rn-2) + rn-2 = (1 + qnqn-1)rn-2 + (– qn)rn-3 … (3)

Thus we have now been able to represent the gcd rn as a linear combination of rn-2 and rn-3·

Continuing backward through the equations in the algorithm, we can successively eliminate the
remainders rn-1, rn-2, . . . , r2, r1 until a stage is reached where rn = gcd(a, b) is expressed as a linear
combination of a and b.

Thus, by successively using the steps of the Euclidean Algorithm in the reverse order, this method
described above allows us to obtain the gcd(a, b) as a linear combination of a and b.

Example 3

Find integers x and y satisfying: gcd(6319, 3763) = 6319x + 3763y.

Solution

We first find gcd(6319, 3763) using the Euclidean Algorithm as shown below.

6319 = 1 × 3763 + 2556 … (1)


3763 = 1 × 2556 + 1207 … (2)
2556 = 2 × 1207 + 142 … (3)
1207 = 8 × 142 + 71 … (4)
142 = 2 × 71 + 0 … (5)

Hence gcd(6319, 3763) = 71.


We can now use these steps of the Euclidean Algorithm in the reverse order, starting from the second
last step.

From (4), we can write the gcd 71 of 6319 and 3763, as a linear combination of the previous 2
remainders 142 and 1207 as follows:

71 = (–8) × 142 + (1) × 1207 … (6)

From (3), we obtain the value of 142 as: 142 = (–2) × 1207 + 2556.

Substituting this value of 142 from (3) in (6), we get:

71 = (–8) × [(–2) × 1207 + 2556] + (1) × 1207

 71 = (17) × 1207 + (–8) × 2556 … (7)

Thus, in (7), we have now expressed the gcd 71 as a linear combination of 1207 and 2556.

From (2), we obtain the value of 1207 as: 1207 = (–1) × 2556 + 3763.

Substituting this value of 1207 from (2) in (7), we get:

71 = (17) × [(–1) × 2556 + 3763] + (–8) × 2556

 71 = (–25) × 2556 + 17 × 3763 … (8)

Thus, in (8), we have expressed the gcd 71 as a linear combination of 2556 and 3763.

From (1), we obtain the value of 2556 as: 2556 = (–1) × 3763 + 6319.

Finally, substituting the value of 2556 from (1) in (8), we get:

71 = (–25) × [(–1) × 3763 + 6319] + 17 × 3763

 71 = (42) × 3763 + (–25) × 6319 … (9)

Thus, we have finally been able to write 71, the gcd of 6319 and 3763, as a linear combination of 6319
and 3763.

Hence from (9), it follows that (–25, 42) is one pair of integers (x, y) satisfying:

gcd(6319, 3763) = 6319x + 3763y.

This extension to the Euclidean Algorithm, which computes not only the gcd of integers a and b, but also
computes the coefficients of Bézout's Identity (i.e. integers x and y satisfying ax + by = gcd(a, b)), is
sometimes referred to as the Extended Euclidean Algorithm.
Common Multiple

If a and b are any two nonzero integers, then an integer m is said to be a common multiple of a and b if
a ∣ m and b ∣ m.

Example: 336 is a common multiple of 24 and 42.

Note: 0 is a common multiple of any two nonzero integers. Moreover, the products ab and –ab are both
common multiples of a and b, of which one is positive. Thus the set of positive common multiples of a
and b is non-empty; hence, by the Well-Ordering Principle, it must contain a smallest integer.

Least Common Multiple

Let a and b be nonzero integers. The least common multiple of a and b, denoted by lcm(a, b), is the
positive integer m satisfying the following:

(i) a ∣ m and b ∣ m.
(ii) If a ∣ c and b ∣ c, where c > 0, then m ≤ c.

The first condition means that that the least common multiple m of a and b is a positive common
multiple of a and b; the second condition means that the lcm m cannot exceed any positive common
multiple of a and b.

Examples: lcm(12, 18) = 36; lcm(–24, 40) = 120.

Theorem: For positive integers a and b,

gcd(a, b) × lcm(a, b) = ab

Proof

Let d = gcd(a, b). Hence it follows that:

d ∣ a and d ∣ b

 a = rd and b = sd, for some positive integers r and s. … (1)

Let us define

m = rsd … (2a)

 d × m = d × rsd = rd × sd = ab {substituting the values of a and b from (1)} … (2b)

Since r, s and d are all positive integers, clearly m too is a positive integer. … (3)

We will now attempt to show that this positive integer m, is actually the lcm of a and b. In other words,
we wish to prove the following two results:
R1. m is a positive common multiple of a and b.

R2. m does not exceed any positive common multiple of a and b.

From (2a), we get:

m = s(rd) = sa {using the value of a from (1)}

 a∣m i.e. m is a multiple of a … (4)

Again, from (2a), we get:

m = r(sd) = rb {using the value of b from (1)}

 b∣m i.e. m is a multiple of b … (5)

From (3), (4) and (5), we get:

m is a positive common multiple of a and b … (6)

Let c be any positive integer that is a common multiple of a and b. Hence we can write:

a ∣ c and b ∣ c

 c = ua and c = vb for some positive integers u and v. … (7)

Since d = gcd(a, b), from Bézout's Identity, we know that there exist integers x and y such that:

d = ax + by … (8)

Multiplying (8) by c, we get

cd = c(ax) + c(by)

 cd = vb(ax) + ua(by) {substituting the 2 values of c from (7) appropriately}

 cd = ab(vx + uy)

 cd = (d × m)(vx + uy) {substituting ab = d × m from (2b)}

 c = m(vx + uy) {cancelling d, note that the gcd d is positive}

 m∣c {since v, x, u, y are all integers, so is vx + uy}


If a ∣ b and b ≠ 0, then |a| ≤ |b|
 m≤c {using divisibility property P4}

Thus, m is less than or equal to any positive common multiple c of a and b. … (9)

Hence from (6) and (9), by definition of the least common multiple,

m = lcm(a, b)

Therefore, if we substitute back d = gcd(a, b) and m = lcm(a, b) in (2b), we get

gcd(a, b) × lcm(a, b) = ab
Corollary: For positive integers a and b, lcm(a, b) = ab if and only if gcd(a, b) = 1.

Proof

Since this is an “if and only if” statement, there are actually two statements to be proved here. We leave
the proofs as a simple exercise for the reader.

Example

gcd(24, 30) = 6 and lcm(24, 30) = 120; gcd(24, 30) × lcm(24, 30) = 6 × 120 = 720 = 24 × 30.

Methods to find LCM of two positive integers a and b

1. First find gcd(a, b) by using the Euclidean algorithm (or by any other method).
Then calculate lcm(a, b) from the result we proved above: gcd(a, b) × lcm(a, b) = ab.

2. Write down the prime factorization for each of the two integers a and b.
a2 a3 a5 a7 a11 b2 b3 b5 b7 b11
Suppose a = 2 ×3 ×5 ×7 × 11 × . . . and b = 2 ×3 ×5 ×7 × 11 ×...

Note that all exponents above are non-negative integers. If a prime p does not divide a (or b) then the
corresponding exponent ap (or bp) is zero.
max(a2, b2) max(a3, b3) max(a5, b5) max(a7, b7) max(a11, b11)
Then lcm(a, b) = 2 ×3 ×5 ×7 × 11 ×...

Here max(r, s) stands for the maximum of r and s i.e. if r ≥ s, max(r, s) = r; if r < s, max(r, s) = s.

3. List all positive multiples of the larger of the two integers in increasing order, starting from its lowest
positive multiple (viz. the larger integer itself) and choose the smallest multiple in this list that is also a
multiple of the other (smaller) integer.

Exercise Problems

P1. The Fibonacci sequence is defined recursively as follows:

F1 = 1, F2 = 1 and Fn = Fn–1 + Fn–2 for all n > 2.

Suppose Fa and Fb are the largest 3 digit number and the second largest 3 digit number respectively in
this sequence. Find the values of Fa and Fb. Now find gcd(Fa, Fb).

P2. Find integers a and b satisfying: gcd(6047057, 12097133) = 6047057a + 12097133b.

P3. Find the value of the following sum:


2387

∑ gcd(𝑟, 2387)
𝑟=1

P4. Find all values of the natural number a, for which the following fraction is irreducible.
10𝑎 + 27
17𝑎 + 46
12 4 8
Example: The fraction is reducible, since it can be reduced to ; however, the fraction is
15 5 15
irreducible.
238 98
P5. Find gcd(2 – 1, 2 – 1).
n n n
P6. If gcd(a, b) = d, then for any natural number n, prove that gcd(a , b ) = d .

P7. Find gcd(1111 . . . 1111, 111 . . . 111) where the first number is a 300 digit number with each digit
equal to 1, while the second number is a 80 digit number with each digit equal to 1.

P8. Find integers u and v satisfying: 1073u + 2291v = 1.

P9. For how many natural numbers B less than 2009, is the following fraction reducible?
𝐵 + 15
𝐵2 + 64
P10. We have a 9-litre jug and an 11-litre jug, both empty. The permissible operations are as follows:

 Fill a jug completely with water.


 Transfer water from one jug to another, stopping if the other jug is filled.
 Empty a jug of water.

Starting with these empty jugs and performing only the allowed operations, we wish to end up with one
jug having exactly 1 litre of water.

If you believe this is indeed possible, find a sequence of operations to do so.

If you believe this is not possible, prove your claim.

You might also like