LCM and HCF
Enter two or more positive whole numbers separated by commas. You get both answers first, then the working one small step at a time. Switch between four methods: prime factors, a division ladder, Euclid's method and listing.
Try an example
Or a word problem
Step-by-step
waitingFill in the fields and press Solve. The full method will appear here, one numbered step at a time.
Which method helped you? Tell us what was confusing.
Worked example
Find the LCM and HCF of 12, 18 and 30.
- 1.
Break each number into prime factors. A prime only divides by 1 and itself. A repeated prime is written as a power, so 2 × 2 is written 2².
12=2×2×3=22×3How was this found?
Divide by the smallest prime that fits, again and again, until you reach 1:12 ÷ 2 = 6 → 6 ÷ 2 = 3 → 3 ÷ 3 = 1
18=2×3×3=2×32How was this found?
Divide by the smallest prime that fits, again and again, until you reach 1:18 ÷ 2 = 9 → 9 ÷ 3 = 3 → 3 ÷ 3 = 1
30=2×3×5How was this found?
Divide by the smallest prime that fits, again and again, until you reach 1:30 ÷ 2 = 15 → 15 ÷ 3 = 5 → 5 ÷ 5 = 1
- 2.
Line the primes up in a table: one row per prime, with its power in each number. A dash means that prime is not in the number.
Prime 12 18 30 Lowest Highest 2 22 2 2 2 22 3 3 32 3 3 32 5 – – 5 none 5 lowest power (builds the HCF)highest power (builds the LCM) - 3.
HCF: for each prime that appears in every number, take its lowest power. Then multiply.
HCF =2×3=6 - 4.
LCM: for every prime that appears anywhere, take its highest power. Then multiply.
LCM =22×32×5=180 - 5.
Check the answer. The HCF must divide every number, and every number must divide the LCM.
HCF 6 goes into each number: 12 ÷ 6 = 2, 18 ÷ 6 = 3, 30 ÷ 6 = 5 ✓ Each number goes into LCM 180: 180 ÷ 12 = 15, 180 ÷ 18 = 10, 180 ÷ 30 = 6 ✓
Answer: HCF = 6 · LCM = 180
Note: Needs two to eight positive whole numbers, each up to one trillion. Listing only runs for small numbers.
Use “Load worked example” above to run this in the solver.
Related formulas
The formulas this tool uses, each explained with symbols, conditions and its own example in the Formula Library.