Three distinct routes lead to the LCM, each preferable in different situations. Listing multiples is intuitive but slow as numbers grow; prime factorization is systematic when factor structures are accessible; the GCD formula is fastest when the Euclidean algorithm is at hand. The table below collects all three side by side — with the kind of inputs each handles best, the mechanics in one line, and a worked example.
| Method |
Best for |
How it works |
Worked example |
| Listing multiples |
small inputs; quick intuition; classroom explanation |
write out the multiples of each number; the first number that appears in both lists is the LCM |
lcm(6, 8): 6, 12, 18, 24, … and 8, 16, 24, … → first match is 24 |
| Prime factorization |
factorizations are easy to obtain or already known |
factor both numbers; for each prime, take the maximum exponent that appears in either factorization |
lcm(12, 18): 12 = 2² · 3, 18 = 2 · 3² → 2² · 3² = 36 |
| GCD formula |
larger numbers; GCD already known or easily computed via the Euclidean algorithm |
apply lcm(a, b) = (a · b) / gcd(a, b); for safety, divide before multiplying: (a / gcd) · b |
lcm(12, 18): gcd(12, 18) = 6 → (12 · 18) / 6 = 36 |