| • Science | • People | • Locations | • Timeline |
The least common multiple is useful when adding or subtracting fractions, because it yields the lowest common denominator. Consider for instance
where the denominator 42 was used because lcm(21, 6) = 42.
If a and b are not both zero, the least common multiple can be computed by using the greatest common divisor (gcd) of a and b:
Thus, the Euclidean algorithm for the gcd also gives us a fast algorithm for the lcm. To return to the example above,
The formula
is adequate to calculate the lcm for small numbers using the formula as written.
Because that (ab)/c = a(b/c) = (a/c)b, one can calculate the lcm using the above formula more efficiently, by firstly exploiting the fact that b/c or a/c may be easier to calculate than the quotient of the product ab and c. This can be true whether the calculations are performed by a human, or a computer, which may have storage requirements on the variables a, b, c, where the limits may be 4 byte storage - calculating ab may cause an overflow, if storage space is not allocated properly.
Using this, we can then calculate the lcm by either using:
or
Done this way, the previous example becomes:
For example:
Here we have the composite number 90 made up of one atom of the prime number 2 , two atoms of the prime number 3 and one atom of the prime number 5.
We can use this knowledge to easily find the lcm of a group of numbers.
For example: Find the value of lcm(45, 120, 75)
The lcm is the number which has the greatest multiple of each different type of atom. Thus