Greatest Common Divisor

The greatest common divisor (gcd) of two or more integers, when at least one of them is not zero, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 6 and 9 is 3.

The greatest common divisor is also known as the greatest common factor (gcf), highest common factor (hcf), greatest common measure (gcm), or highest common divisor.

Using prime factorizations

Greatest common divisors can in principle be computed by determining the prime factorization of the two numbers and comparing factors, as in the following example: to compute gcd(81, 60), we find the prime factorizations 81 = 34 and 60 = 22 · 3 · 5 and notice that the “overlap” of the two expressions is 3; so gcd(81, 60) = 3. In practice, this method is only feasible for small numbers; computing prime factorizations in general takes far too long.

Here is another concrete example, illustrated by a Venn diagram. Suppose it is desired to find the greatest common divisor of 81 and 60. First, find the prime factorizations of the two numbers: