Greatest Common Divisor
Greatest Common Divisor
Math is Fun!
Who is Euclid?
https://medium.com/@sunfa
ceman/math-and-magic-
euclid-defines-space-
ea987f61709c
The Greek mathematician Euclid lived and flourished in Alexandria in Egypt around 300
BCE, during the reign of Ptolemy I. Almost nothing is known of his life, and no likeness or
first-hand description of his physical appearance has survived antiquity, and so depictions of
him (with a long flowing beard and cloth cap) in works of art are necessarily the products of
the artist’s imagination.
He probably studied for a time at Plato’s Academy in Athens but, by Euclid’s time,
Alexandria, under the patronage of the Ptolemies and with its prestigious and
comprehensive Library, had already become a worthy rival to the great Academy.
Euclid is often referred to as the “Father of Geometry”, and he wrote perhaps the most
important and successful mathematical textbook of all time, the “Stoicheion” or “Elements”,
which represents the culmination of the mathematical revolution which had taken place in
Greece up to that time. He also wrote works on the division of geometrical figures into into
parts in given ratios, on catoptrics (the mathematical theory of mirrors and reflection), and
on spherical astronomy (the determination of the location of objects on the “celestial
sphere”), as well as important texts on optics and music.
The “Elements” remained the definitive textbook on geometry and mathematics for
well over two millennia, surviving the eclipse in classical learning in Europe during the Dark
Ages through Arabic translations. It set, for all time, the model for mathematical argument,
following logical deductions from inital assumptions (which Euclid called “axioms” and
“postulates”) in order to establish proven theorems.
The “Elements” also includes a series of theorems on the properties of numbers and
integers, marking the first real beginnings of number theory. For example, Euclid proved
what has become known as the Fundamental Theorem of Arithmethic (or the Unique
Factorization Theorem). He was the first to realize – and prove – that there are infinitely
many prime numbers. The basis of his proof, often known as Euclid’s Theorem, is that, for
any given (finite) set of primes, if you multiply all of them together and then add one, then a
new prime has been added to the set (for example, 2 x 3 x 5 = 30, and 30 + 1 = 31, a prime
number) a process which can be repeated indefinitely.
Euclid also identified the first four “perfect numbers”, numbers that are the sum of all their
divisors (excluding the number itself):
6 = 1 + 2 + 3;
28 = 1 + 2 + 4 + 7 + 14;
496 = 1 + 2 + 4 + 8 + 16 + 31 + 62 + 124 + 248; and
8,128 = 2 + 4 + 8 + 16 + 32 + 64 + 127 + 254 + 508 + 1,016 + 2,032 + 4,064.
Introduction
You have learned in your elementary mathematics how to find the Greatest
Common Divisor (GCD) or commonly known as Greatest Common Factor (GCF) for
relatively small numbers. To find it, you will just apply prime factorization to
determine all the positive divisors or factors of two numbers and finally choose the
greatest or the largest divisor or factor common to each number. However, this
method would be time-consuming and tiresome when you deal with large numbers.
Don’t worry a mathematician solved that problem by developing an algorithm or a
systematic method which was named after him- the Euclidian algorithm. In this
lesson, you will learn how to apply this algorithm in finding the Greatest Common
Divisor of large numbers.
Objectives
1. State the basis of Euclidian algorithm in finding the Greatest Common Divisor
(GCD); and
2. Apply the Euclidian algorithm to determine the Greatest Common Divisor (GCD).
Find gcd (a, b) using the Euclidean Algorithm for each of the values below:
(1) a = 37, b = 60
“The greatest common divisor of two numbers a and b (not both zero) is the largest
number that divides both of them. It is denoted by gcd (a, b). If gcd (a, b) = 1, we say
that a and b are relatively prime.”
Note: gcd stands for greatest common divisor
Let’s have two examples of finding GCD using the method your are very familiar
with - prime factorization.
12 20
4 3 4 5
2 2 2 2
22, 3 22, 5
Using factor tree method, 12 has 22 and 3 and 20 has 22 and 5 as its prime
factors. To find the GCD, we choose the greatest or largest divisor common to 12
and 20. In this case, its 4. Therefore, gcd(12, 20) = 4.
Using factorization in finding the GCD may seem easy and efficient but for large
numbers, it would not be that efficient.
The most efficient method known for finding the greatest common divisors of
two numbers especially large numbers is called the Euclidean algorithm. It consists
of doing a sequence of divisions with remainder until the remainder is zero.
Let’s see how to do it.
Example 1: Find gcd(36, 132).
Step 1: Divide 132 by 36. This will give us a quotient of 3 and a remainder of 24.
We write this as 132 = 3 x 36 + 24.
Step 2: Take 36 and divide it by the remainder 24 from the previous step.This
gives 36 = 1 x 24 + 12.
Step 3: Divide 24 by 12, and we find a remainder of 0, like this 24 = 2 x 12 + 0.
“The Euclidean algorithm says that as soon as you get a remainder of 0, the
remainder from the previous step is the greatest common divisor of the original two
numbers. So in this case we find that gcd (132, 36) = 12.”
(2) gcd(12345,67890)
(3) gcd (54321,9876)
Useful References:
Burton, D.M. (2007). Elementary number theory (6th ed.) The McGraw-Hill
Companies, Inc.
Rosen, K.H. (1986) Elementary number theory and its applications. Addison -
Wesley Publishing Company.