Mathematics · Glossary

What is GCD?

Also known as: greatest common divisor · coprime

Definition 64.10 Primary & Middle School Mathematics · Chapter 64 — Arithmetic: Divisors and Prime Numbers

The greatest common divisor of two positive integers aa and bb, written gcd(a,b)\gcd(a, b), is the largest integer dividing both. When gcd(a,b)=1\gcd(a, b) = 1, the integers are called coprime: they share no divisor except 11.

Examples

Example 64.13

360=23×32×5360 = 2^3 \times 3^2 \times 5 and 84=22×3×784 = 2^2 \times 3 \times 7. Common primes: 22 (exponents 33 and 22: keep 22) and 33 (exponents 22 and 11: keep 11). So

gcd(360,84)=22×3=12.\gcd(360, 84) = 2^2 \times 3 = 12 .

Example 64.15

Compute gcd(1071,462)\gcd(1071, 462):

1071=462×2+147,462=147×3+21,147=21×7+0.\begin{align*} 1071 &= 462 \times 2 + 147, \\ 462 &= 147 \times 3 + 21, \\ 147 &= 21 \times 7 + 0 . \end{align*}

The last nonzero remainder is 2121: gcd(1071,462)=21\gcd(1071, 462) = 21.

Read in context →
Definition 29.7 High School Mathematics · Chapter 29 — Arithmetic

Let a,ba, b be integers, not both zero. The greatest common divisor gcd(a,b)\gcd(a, b) is the largest integer dividing both aa and bb. When gcd(a,b)=1\gcd(a,b) = 1, aa and bb are said to be coprime.

Examples

Example 29.9

gcd(252,198)\gcd(252, 198): 252=198+54252 = 198 + 54; 198=3×54+36198 = 3\times54 + 36; 54=36+1854 = 36 + 18; 36=2×18+036 = 2 \times 18 + 0. Hence gcd(252,198)=18\gcd(252,198) = 18.

Read in context →