How to use the LCM & GCD Calculator
- Enter two or more numbers
- Separate them with commas
- See the LCM, GCD and prime factors
LCM and GCD of any set of numbers
Enter two or more numbers, separated by commas or spaces, to get the LCM (least common multiple) and the GCD โ also called the HCF or GCF (greatest common factor). Each number's prime factorisation is listed alongside, so you can check your working.
Worked examples
- 24 = 2ยณ ร 3 and 36 = 2ยฒ ร 3ยฒ. The LCM takes the highest powers: 2ยณ ร 3ยฒ = 72. The GCD takes the lowest: 2ยฒ ร 3 = 12.
- The LCM of 8, 24 and 36 is also 2ยณ ร 3ยฒ = 72.
- Shortcut for two numbers: LCM = a ร b รท GCD โ 24 ร 36 รท 12 = 72.
Methods taught in school
- Prime factorisation โ break each number into primes, as above.
- Division (Euclid's algorithm) โ divide, keep the remainder, repeat: 36 รท 24 = 1 r 12; 24 รท 12 = 2 r 0 โ GCD 12.
- Ladder method โ divide all the numbers by common primes in a ladder, then multiply the numbers down the side and along the bottom for the LCM.
In Python, math.gcd() and math.lcm() do the same job.
Frequently asked questions
How accurate is the LCM & GCD Calculator?
LCM & GCD Calculator uses standard, widely accepted formulas and calculates instantly as you type. Results are for general information โ for important academic decisions, please confirm with a qualified professional or your institution.