What is GCD(18, 31)?
The GCD (Greatest Common Divisor) is the largest number that can divide two (or more) numbers without leaving a remainder.
The GCD of 18 and 31 is 1.
How to compute GCD(18, 31)
Comparing the divisors of 18 and 31
This first method consists in listing the divisors of the two numbers and then identifying the largest one they have in common.
Divisors of 18:
1, 2, 3, 6, 9, 18
Divisors of 31:
1, 31
We can see from these two lists that the greatest divisor they have in common is: 1
For small numbers, this can be done quickly. However, as numbers increase, the list of potential divisors grows longer, making this method cumbersome and less practical.
Euclid's algorithm
Fortunately, there's a much more efficient method: Euclid's algorithm. It's particularly well-suited to larger numbers. Here's how it works:
- Divide 31 by 18. The quotient is 1 and the remainder is 13.
- The previous divisor (18) is now the dividend. The remainder (13) is the new divisor. Divide 18 by 13. The quotient is 1 and the remainder is 5.
- The previous divisor (13) is now the dividend. The remainder (5) is the new divisor. Divide 13 by 5. The quotient is 2 and the remainder is 3.
- The previous divisor (5) is now the dividend. The remainder (3) is the new divisor. Divide 5 by 3. The quotient is 1 and the remainder is 2.
- The previous divisor (3) is now the dividend. The remainder (2) is the new divisor. Divide 3 by 2. The quotient is 1 and the remainder is 1.
- The previous divisor (2) is now the dividend. The remainder (1) is the new divisor. Divide 2 by 1. The quotient is 2 and the remainder is 0.
- When you reach a remainder of 0, the last divisor (in this case, 1) is the GCD.