What the LCM and GCD Calculator does
The LCM and GCD Calculator finds the least common multiple and the greatest common divisor, also called the highest common factor, of any list of whole numbers. It shows each number as a product of primes (the Prime Number Checker finds them for a single number) and, for two numbers, the steps of Euclid’s algorithm, so you can see exactly how the answer was reached.
How to use it
- Enter two or more whole numbers, separated by commas or spaces.
- Read the GCD and LCM in the result card.
- Look below for each number in prime factors and, for two numbers, Euclid’s steps.
Example
For 12, 18 and 30: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5. The GCD takes the lowest power of each shared prime, 2 × 3 = 6. The LCM takes the highest power of every prime, 2² × 3² × 5 = 180. So 180 is the smallest number all three divide into.
Where you meet LCM and GCD
The LCM gives the common denominator when 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 tile that fits a floor exactly.
For two numbers, LCM × GCD equals the two numbers multiplied together.
Questions people ask
Is GCD the same as HCF?
Yes. Greatest common divisor, highest common factor and greatest common factor all mean the same thing.
Can I use very large numbers?
Yes. The GCD and LCM use exact whole-number arithmetic. Prime factors are shown for numbers up to about 9 quadrillion.
How does Euclid’s algorithm work?
Divide the larger number by the smaller and keep the remainder. Repeat with the smaller number and the remainder until the remainder is zero. The last divisor is the GCD.
What if one of the numbers is zero?
The GCD of 0 and 12 is 12, because every number divides 0. The LCM involving 0 is 0. At least one number must not be zero.