What this calculates
Enter two, three or four whole numbers and this finds their least common multiple (LCM) and greatest common divisor (GCD, also called the HCF), shows the prime factors of each, and says whether they are coprime.
The formula
Prime factors
write each number as a product of primes, such as 12 = 2² × 3
GCD (HCF)
the product of the primes in every number, each at its lowest power
LCM
the product of every prime that appears, each at its highest powerTwo numbers
GCD(a, b) × LCM(a, b) = a × bWorked example
Adding a third number, 30 = 2 × 3 × 5, keeps the GCD at 6 and brings in a 5, so the LCM becomes 2² × 3² × 5 = 180.
When to use it, and the mistakes to avoid
Use it to find a common denominator for fractions, to simplify a fraction or ratio, for maths homework on HCF and LCM, and for timing problems where repeating events need to line up.
The mistakes that cost the most:
- Multiplying the numbers for the LCM. 12 × 18 = 216 is a common multiple, but not the least — that is 36.
- Taking the wrong powers. The GCD takes each shared prime at its lowest power; the LCM takes every prime at its highest.
- Leaving a prime out of the LCM. A prime in only one number still goes in.
- Using GCD × LCM = product for three numbers. It only works for two.
- Forgetting 1 is always a common divisor. If nothing else divides them all, the GCD is 1, not 0.
FAQ
What is the LCM?
The least common multiple is the smallest number that every one of the numbers divides into exactly. The LCM of 12 and 18 is 36: it is in the 12 times table (12 × 3) and the 18 times table (18 × 2), and no smaller number is in both.
What is the GCD, or HCF?
The greatest common divisor - also called the highest common factor (HCF) or greatest common factor (GCF) - is the largest number that divides every one of the numbers exactly. The GCD of 12 and 18 is 6.
How do I find the LCM and GCD by prime factors?
Break each number into primes: 12 = 2² × 3 and 18 = 2 × 3². For the GCD, take the primes they share at their lowest power: 2 × 3 = 6. For the LCM, take every prime at its highest power: 2² × 3² = 36.
Is there a link between the LCM and GCD?
For two numbers, yes: GCD × LCM = the two numbers multiplied. 6 × 36 = 216 = 12 × 18. So once you have one, you can find the other. This does not hold for three or more numbers.
What does coprime mean?
Two numbers are coprime when their GCD is 1 - they share no factor except 1, like 8 and 9. Their LCM is then simply the two multiplied together: 72.
Where are the LCM and GCD used?
The LCM gives the lowest common denominator for adding fractions, and tells you when repeating events line up - buses every 12 and 18 minutes leave together every 36 minutes. The GCD simplifies fractions and ratios, and finds the largest equal pieces something can be cut into.