Using Euclid's Algorithm to Find the Greatest Common Divisor of Two Positive Integers
Using Euclid’s Algorithm to Find the Greatest Common Divisor of Two Positive Integers
Understanding Euclid’s Algorithm
- Euclid’s Algorithm is a process used to find the Greatest Common Divisor (GCD) or Highest Common Factor (HCF) of two positive integers.
- It is an iterative method which reduces the problem of finding the GCD of two numbers to the problem of finding the GCD of smaller pairs of numbers.
- The algorithm is based on the principle that the GCD of two numbers also divides their difference.
Applying Euclid’s Algorithm Step by Step
Step 1: Arrange the two integers in decreasing order. The greater integer becomes ‘a’ and the lesser integer is termed ‘b’.
Step 2: Divide ‘a’ by ‘b’. Calculate the quotient and the remainder.
Step 3: Replace ‘a’ with ‘b’ and ‘b’ with the remainder from Step 2.
Step 4: Repeat Step 2 and Step 3 until you get a remainder of zero.
Step 5: The last non-zero remainder obtained in the process is the GCD of the original pair of numbers.
Example of Euclid’s Algorithm
Consider two positive integers, 420 and 120.
- Firstly, divide the larger number (420) by the smaller number (120). The quotient is 3 and the remainder is 60.
- Now, replace 420 with 120 and 120 with the remainder 60, and carry out the division again. The new quotient is 2 and the remainder is 0.
- Since the remainder is now zero, the process stops. The last non-zero remainder (which is 60) is the GCD of 420 and 120.
Importance of Euclid’s Algorithm
- Euclid’s Algorithm is one of the oldest algorithms in common use. It originates from Euclid’s Elements (circa 300 BC).
- It is a simple and efficient method. The process requires only basic arithmetic operations, making it easy to understand and implement.
- It plays a central role in number theory and is the underlying principle of several modern algorithms in cryptography and computer science.