Least Common Multiples

The least common multiple of two integers is the smallest integer that is a multiple of both numbers. For example, lcm(4, 6) = 12 and lcm(10, 15) = 30. As with greatest common divisors, there are many methods for computing least common multiples. One method is to factor both numbers into primes. The lcm is the product of all primes that are common to one or the other (or both) of the numbers. For example, to calculate lcm(40, 45), we factor 40 and 45, getting

40 = 2 × 2 × 2 × 5
45 = 3 × 3 × 5

The primes common to one or the other are 2, 2, 2, 3, 3, 5. The least common multiple is then 2 × 2 × 2 × 3 × 3 × 5 = 360.

Another method lists the multiples of both numbers until the first common multiple is found. To use this method efficiently, write down multiples of the first number until the result is larger than the second. Then write down multiples of the second until they are larger than the largest multiple of the first. Continue with this alternating procedure. For example, to find lcm(12, 20), we would write down the multiples

12 20
24  
  40
36  
48  
  60
60  

A third method is to use the formula

lcm(a, b) = a × b / gcd(a, b).

To use this formula we can compute a gcd with the calculator method we saw in the assignment Greatest Common Divisors and then do the multiplication and division. For example, once we see that gcd(40, 45) = 5, we get lcm(40, 45) = 40 × 45 / 5 = 360.

Problem 1. Illustrate the formula lcm(a, b) = a × b / gcd(a, b) by calculating the following examples by using the formula and by calculating the lcm in some other manner and seeing that you get the same value by both methods.

  1. lcm(12, 22)
  2. lcm(24, 60)
  3. lcm(11, 13)

It makes perfect sense to talk about the least common multiple of three or more integers. The prime factorization method works for find the lcm of any number of integers. For example, to find lcm(6, 20, 36), we have

6 = 2 × 3
20 = 2 × 2 × 5
36 = 2 × 2 × 3 × 3

The primes common to one or more are 2, 2, 3, 3, 5. Therefore, lcm(6, 20, 36) = 2 × 2 × 3 × 3 × 5 = 180.

Alternatively, the lcm of three or more integers can be found recursively. For three, the following formula turns calculating the lcm into two other lcm calculations.

lcm(a, b, c) = lcm(a, lcm(b, c)).

Problem 2. Illustrate the formula lcm(a, b, c) = lcm(a, lcm(b, c)) by calculating the following least common multiples both with the formula and with another method, each time seeing that both methods give the same value.

  1. lcm(25, 10, 6)
  2. lcm(30, 20, 15)
  3. lcm(5, 7, 11)