What is GCD
The GCD (greatest common divisor) of two numbers is the largest natural number by which both given numbers are divisible without a remainder.
Notation: GCD(a, b). For example, GCD(12, 18) = 6.
Practice:
The GCD (greatest common divisor) of two numbers is the largest natural number by which both given numbers are divisible without a remainder.
Notation: GCD(a, b). For example, GCD(12, 18) = 6.
The LCM (least common multiple) of two numbers is the smallest natural number that is divisible by both given numbers without a remainder.
Notation: LCM(a, b). For example, LCM(12, 18) = 36.
Method 1 — prime factorization:
Example: GCD(24, 36). 24 = 2³ · 3, 36 = 2² · 3². Common factors: 2² · 3 = 12. So GCD(24, 36) = 12.
Method 2 — Euclidean algorithm: divide the larger number by the smaller, then the smaller by the remainder, and so on until zero. The last non-zero remainder is the GCD.
Method 1 — prime factorization:
Example: LCM(24, 36). 24 = 2³ · 3, 36 = 2² · 3². Maximum exponents: 2³ · 3² = 72. So LCM(24, 36) = 72.
Method 2 — via GCD: LCM(a, b) = (a · b) / GCD(a, b).
GCD and LCM are actively used when working with fractions:
Examples of computing GCD and LCM:
GCD — greatest common divisor: the largest number by which both numbers are divisible without a remainder. LCM — least common multiple: the smallest number that is divisible by both numbers without a remainder.
The fastest way is the Euclidean algorithm: divide the larger number by the smaller, then the smaller by the remainder, and so on until zero. The last non-zero remainder is the GCD.
LCM(a, b) = (a · b) / GCD(a, b). For example, LCM(12, 18) = (12 · 18) / 6 = 36.
Coprime numbers are numbers whose GCD is 1. For example, 7 and 11, 8 and 9. The LCM of coprime numbers equals their product.