§ 98. First Method: By Prime Factorization
Let it be required to find the greatest common divisor of two numbers, 180 and 126. For this purpose, we first decompose these numbers into prime factors:
Comparing the factors of these numbers, we observe that there are common factors among them, namely: 2, 3, 3. Each of these common factors will also be a common divisor of 180 and 126. To obtain composite common divisors, we must multiply the common factors by two and by three. The greatest common divisor, evidently, will be obtained if we multiply all the common factors together.
Let it also be required to find the greatest common divisor of three numbers: 210, 1260, and 245. Let us decompose these numbers into prime factors:
| 210 | 2 |
| 105 | 3 |
| 35 | 5 |
| 7 | 7 |
| 1 |
| 1260 | 2 |
| 630 | 2 |
| 315 | 3 |
| 105 | 3 |
| 35 | 5 |
| 7 | 7 |
| 1 |
| 245 | 5 |
| 49 | 7 |
| 7 | 7 |
| 1 |
Now we see that the greatest common divisor of these numbers is equal to the product of the common factors 5 and 7, that is, equal to 35.
In a similar manner, one can find the greatest common divisor of four, five, or more given numbers.
Using the notation for powers introduced in § 92, we can write the prime factorization of the numbers in the first example considered as follows:
180 = 22 · 32 · 5, 126 = 2 · 32 · 7; in the greatest common divisor of the given numbers, the factors 5 and 7 will not appear at all, since 5 does not appear in the second number, and 7 does not appear in the first number. The factor 2 will enter 1 time, since it enters the decomposition of the second number only 1 time. The factor 3, however, will appear in the greatest common divisor 2 times (that is, to the second power), since it appears in both given numbers to the second power; thus, the greatest common divisor of the given numbers is 2 · 32 = 18.
Thus, the rule stated above can be expressed as follows: to find the greatest common divisor of several numbers, decompose these numbers into prime factors and take the product of the powers of the distinct prime factors that appear in the prime factorization of all the given numbers, where each factor is taken with the smallest exponent with which it occurs in the composition of the given numbers.
Example: the greatest common divisor of the numbers 9000 = 23 · 32 · 53 and 1350 = 2 · 33 · 52 is equal to 2 · 32 · 52 = 450.