‹ Class 9 · Ch 11
The World of Algorithms · Principle 11 of 29

Look at the right end

gcd as the largest common divisor

Stuck? Ask Guru

NCERT: 11.2.2 Finding the Greatest Common Divisor

Think

Lists too long to eyeball

The book asks: what if the numbers were 54000 and 81000? Each has 80 divisors. It is no longer simple to inspect the lists and spot the largest number in both!

Once the list of common divisors is built, where is the greatest one?

What this lesson covers

The idea

Because lists of divisors are in increasing order, the list of common divisors is too, so the gcd is its rightmost element.

Lists too long to eyeball

The book asks: what if the numbers were 54000 and 81000? Each has 80 divisors. It is no longer simple to inspect the lists and spot the largest number in both!

Once the list of common divisors is built, where is the greatest one?

  • At the right end of the list
  • Somewhere in the middle
  • We must search the whole list again

Build the common list

Run the comparison for 54000 and 81000. Watch where each new common divisor goes, and where the largest one ends up.

The rightmost is the greatest

Each list of divisors is in increasing order, so the list of common divisors is too. The gcd is its rightmost element.

The common divisors of 54000 and 81000 form a list of 64 numbers, from 1 up to 27000. No extra search is needed: gcd(54000, 81000) = 27000, the rightmost element.

Notes

Lists of divisors built from 1 upwards are in increasing order, so the gcd is the rightmost element of the list of common divisors.

Check yourself

Why is the list of common divisors in increasing order?

The common divisors of 375 and 825 are [1, 3, 5, 15, 25, 75]. What is gcd(375, 825)?

Answer: 75

The rightmost element is 75, so gcd(375, 825) = 75.

What is gcd(54000, 81000)?

Answer: 27000

gcd(54000, 81000) = 27000.

  • We walk through divisors of the first number in increasing order and add at the end — correct. Yes. The order of the first list is kept.
  • Because we sort it at the end. No sorting is needed.
  • Because 54000 is smaller than 81000. The order comes from how the list is built.