LCM Calculator

Calculate All Binary Photo

LCM Calculator

Math Calculators
  • 19
  • 1075
  • 5 min
  • 0

What is LCM?

In arithmetic and number theory, the least common multiple, lowest common multiple, or smallest common multiple of two integers a and b, usually denoted by lcm(a, b), is the smallest positive integer that is divisible by both a and b. Since division of integers by zero is undefined, this definition has meaning only if a and b are both different from zero. However, some authors define lcm(a,0) as 0 for all a, which is the result of taking the lcm to be the least upper bound in the lattice of divisibility.

The lcm is the "lowest common denominator" (lcd) that can be used before fractions can be added, subtracted or compared. The lcm of more than two integers is also well-defined: it is the smallest positive integer that is divisible by each of them.

A multiple of a number is the product of that number and an integer. For example, 10 is a multiple of 5 because 5 × 2 = 10, so 10 is divisible by 5 and 2. Because 10 is the smallest positive integer that is divisible by both 5 and 2, it is the least common multiple of 5 and 2. By the same principle, 10 is the least common multiple of −5 and −2 as well.

Example, LCM(4,6)

Multiples of 4 are:



Multiples of 6 are:


Common multiples of 4 and 6 are the numbers that are in both lists:


So, from this list of the first few common multiples of the numbers 4 and 6, their least common multiple is 12.

Methods of Calculation

Using the greatest common divisor The following formula reduces the problem of computing the least common multiple to the problem of computing the greatest common divisor (gcd), also known as the greatest common factor:

Using prime factorization The unique factorization theorem indicates that every positive integer greater than 1 can be written in only one way as a product of prime numbers. The prime numbers can be considered as the atomic elements which, when combined together, make up a composite number.

The same method can also be illustrated with a Venn diagram like the one above, with the prime factorization of each of the two numbers demonstrated in each circle and all factors they share in common in the intersection. The lcm then can be found by multiplying all of the prime numbers in the diagram.

Using a simple algorithm This method works easily for finding the lcm of several integers. Let there be a finite sequence of positive integers X = (x1, x2, ..., xn), n > 1. The algorithm proceeds in steps as follows: on each step m it examines and updates the sequence X(m) = (x1(m), x2(m), ..., xn(m)), X(1) = X, where X(m) is the mth iteration of X, that is, X at step m of the algorithm, etc. The purpose of the examination is to pick the least (perhaps, one of many) element of the sequence X(m). Assuming xk0(m) is the selected element, the sequence X(m+1) is defined as xk(m+1) = xk(m), k ≠ k0 xk0(m+1) = xk0(m) + xk0(1). In other words, the least element is increased by the corresponding x whereas the rest of the elements pass from X(m) to X(m+1) unchanged. The algorithm stops when all elements in sequence X(m) are equal. Their common value L is exactly lcm(X). For example, if X = X(1) = (3, 4, 6), the steps in the algorithm produce:

X(2) = (6, 4, 6)

X(3) = (6, 8, 6)

X(4) = (6, 8, 12) - by choosing the second 6

X(5) = (9, 8, 12)

X(6) = (9, 12, 12)

X(7) = (12, 12, 12) so lcm = 12.

Using the table-method This method works for any number of numbers. One begins by listing all of the numbers vertically in a table (in this example 4, 7, 12, 21, and 42):






The process begins by dividing all of the numbers by 2. If 2 divides any of them evenly, write 2 in a new column at the top of the table, and the result of division by 2 of each number in the space to the right in this new column. If a number is not evenly divisible, just rewrite the number again. If 2 does not divide evenly into any of the numbers, repeat this procedure with the next largest prime number, 3 (see below).

x 2

4 2

7 7

12 6

21 21

42 21

Now, assuming that 2 did divide at least one number (as in this example), check if 2 divides again: x 2 2

4 2 1

7 7 7

12 6 3

21 21 21

42 21 21

Once 2 no longer divides any number in the current column, repeat the procedure by dividing by the next larger prime, 3. Once 3 no longer divides, try the next larger primes, 5 then 7, etc. The process ends when all of the numbers have been reduced to 1 (the column under the last prime divisor consists only of 1's). x 2 2 3 7

4 2 1 1 1

7 7 7 7 1

12 6 3 1 1

21 21 21 7 1

42 21 21 7 1

Now, multiply the numbers in the top row to obtain the lcm. In this case, it is 2 × 2 × 3 × 7 = 84. As a general computational algorithm, the above is quite inefficient. One would never want to implement it in software: it takes too many steps and requires too much storage space. A far more efficient numerical algorithm can be obtained by using Euclid's algorithm to compute the gcd first, and then obtaining the lcm by division.

Comments (0)