Formula
GCF = product of shared primes, each to its lowest powerLCM = product of all primes, each to its highest powerFor two numbers: GCF(a, b) × LCM(a, b) = a × b How it works
The greatest common factor (GCF, also called the greatest common divisor or highest common factor) is the largest number that divides evenly into every number in the list. The least common multiple (LCM) is the smallest number that every number in the list divides into.
Prime factorization makes both easy. Write each number as a product of primes. The GCF uses only the primes that all the numbers share, each raised to the smallest power that appears. The LCM uses every prime that appears anywhere, raised to the largest power.
You will use the GCF to simplify fractions (divide top and bottom by it) and the LCM to add fractions (it is the least common denominator). Behind the scenes, this calculator uses Euclid’s algorithm, which finds the GCF by repeatedly replacing the larger number with the remainder of a division.
Frequently asked questions
What is the GCF of two prime numbers?
It is always 1, because primes have no factors other than 1 and themselves. Numbers whose GCF is 1 are called coprime or relatively prime.
How does Euclid’s algorithm work?
Divide the larger number by the smaller and keep the remainder. Then repeat with the smaller number and that remainder. When the remainder hits 0, the last non-zero remainder is the GCF. For 48 and 18: 48 mod 18 = 12, 18 mod 12 = 6, 12 mod 6 = 0, so the GCF is 6.