How this calculator works
- Step 1Factorise12 = 2² × 3Break each number into prime powers.
- Step 2LCMhighest powersTake every prime at its highest power.
- Step 3HCFlowest powersTake only shared primes, at their lowest power.
The LCM is the smallest number that every number in your list divides. The HCF is the largest number that divides all of them.
The calculator finds the HCF with Euclid’s algorithm and builds the LCM from it, then shows the prime factors so you can check both.
Worked example: 12, 18 and 30
- LCM
each prime at its highest power- HCF
each shared prime at its lowest power
- 122² × 3
- 182 × 3²
- 302 × 3 × 5
- LCM2² × 3² × 5180
- HCF2 × 36
Every one of 12, 18 and 30 divides 180, and 6 is the largest number that divides all three.
Euclid’s algorithm
- Rule
HCF(a, b) = HCF(b, a mod b)
- 84 ÷ 3684 = 36 × 2 + 12remainder 12
- 36 ÷ 1236 = 12 × 3 + 0remainder 0
- HCF12
Divide, keep the remainder, and repeat with the divisor and remainder. The last non-zero remainder is the HCF. Then LCM = 84 × 36 ÷ 12 = 252.
Read the result
- LCM180When things line up again: buses every 12, 18 and 30 minutes meet every 180 minutes.
- HCF6The biggest equal share: the largest group size that splits all three exactly.
Buses every 15, 20 and 25 minutes all leave together again after 300 minutes.
If two numbers share no prime, their HCF is 1 and the LCM is their product: 8 and 15 give 120.
Assumptions and limits
- Whole numbers2 to 20 numbers, each from 1 to 10,00,000.
- No decimalsZero, negatives and fractions are rejected.
- Exact LCMLarge LCMs are worked in exact integers.
- Euclid for twoThe division steps are shown for the first pair.
Related number tools
LCM and HCF both come from prime factors.
To see a number’s prime factors, use the prime factorization calculator, or every factor with the factor calculator. Common denominators for fractions are worked out in the fraction calculator.
Common mistakes
Mistake: Multiplying all the numbers for the LCM.
Instead: Only co-prime numbers give their product.
Mistake: Taking the highest powers for the HCF.
Instead: HCF uses the lowest power of each shared prime.
Mistake: Using HCF × LCM = product for three numbers.
Instead: That identity holds for two numbers only.
Checking the method
A separate script re-works every golden value by testing divisors and stepping through multiples, without Euclid or prime factors.
Read how we test our calculators, or browse more maths calculators.