Formula
GCF(a, b) = GCF(b, a mod b), GCF(a, 0) = aLCM(a, b) = a × b ÷ GCF(a, b)For more numbers: GCF(a, b, c) = GCF(GCF(a, b), c), same for LCM
How it works
The greatest common factor comes from Euclid’s algorithm: replace the larger number by its remainder when divided by the smaller one until the remainder is zero. The last non-zero value divides every number in the list. The least common multiple follows from it, because a × b = GCF × LCM for any two numbers.
The prime factorizations show the same answer another way. The GCF takes each prime that appears in every number, at its lowest power; the LCM takes every prime that appears anywhere, at its highest power. Integer arithmetic is exact, so even large LCMs are shown in full.
Worked examples
24 and 56
24 = 2³ × 3 and 56 = 2³ × 7, so the GCF is 2³ = 8 and the LCM is 2³ × 3 × 7 = 168.
- Whole numbers
- 24, 56
- Greatest common factor (GCF / GCD)
- 8
Common denominator for 1/4, 1/6, 1/15
The LCM of the denominators is 60, the least common denominator; the GCF is 1.
- Whole numbers
- 4 6 15
- Greatest common factor (GCF / GCD)
- 1
Where GCF and LCM are used
- Simplifying fractions: divide top and bottom by their GCF (18/24 → 3/4).
- Adding fractions: the LCM of the denominators is the least common denominator.
- Scheduling: two events every 6 and 8 days coincide every LCM(6, 8) = 24 days.
- Tiling or cutting: the largest equal square that fits a 24 × 56 area has side GCF = 8.
Relatively prime numbers
Numbers whose GCF is 1, such as 8 and 15, share no prime factor. Their LCM is simply their product.
Related calculators
- Fraction CalculatorAdd, subtract, multiply, or divide two fractions and get the answer in lowest terms, as a mixed number, and as a decimal.
- Ratio CalculatorReduce a ratio to its simplest form or find the missing term in a proportion such as 3 : 4 = 15 : ?.
- Rounding CalculatorRound a number to the nearest tenth, hundredth, whole number, ten, hundred, or thousand, using standard, banker’s, up, down, or truncate rules.
Last reviewed: