How it works
The greatest common factor (GCF, also called the greatest common divisor GCD or highest common factor HCF) is the largest whole number that divides every number in the list. The least common multiple (LCM) is the smallest positive number that every number in the list divides into.
GCF by Euclid’s algorithm: gcd(a, b) = gcd(b, a mod b), until the remainder is 0 lcm(a, b) = |a × b| ÷ gcd(a, b) · for a list, apply pair by pairWorked example. For 12, 18 and 30: gcd(12, 18) = 6 and gcd(6, 30) = 6, so GCF = 6. lcm(12, 18) = 216 ÷ 6 = 36, and lcm(36, 30) = 1,080 ÷ 6 = 180. Check with prime factors: 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. GCF takes the lowest powers (2 × 3 = 6); LCM takes the highest (2² × 3² × 5 = 180).
Euclid’s algorithm step by step
To find gcd(48, 18): 48 = 2 × 18 + 12 → gcd(18, 12); 18 = 1 × 12 + 6 → gcd(12, 6); 12 = 2 × 6 + 0 → the answer is 6. It is fast even for very large numbers, which is why calculators and computers use it.
Where you use them
- Simplifying fractions: divide top and bottom by the GCF. 18/30 → divide by 6 → 3/5.
- Adding fractions: the LCM of the denominators is the lowest common denominator. 1/12 + 1/18 → denominator 36.
- Scheduling: buses every 12 and 18 minutes leave together every 36 minutes (the LCM).
- Tiling and cutting: the largest square tile that fits a 48 × 18 floor exactly is 6 × 6 (the GCF).
Special cases
If the GCF is 1, the numbers are coprime, and their LCM is their product. Zero is not accepted, and the LCM of large lists can grow beyond what can be shown exactly — the calculator tells you when that happens.
Working with fractions? Use the fraction calculator. For averages of a list, try the average calculator, and for equations the quadratic formula calculator.