In arithmetic and

^{3}, 3^{2}, and 7^{1}, respectively. Thus,
:$\backslash operatorname(8,9,21)\; =\; 2^3\; \backslash cdot\; 3^2\; \backslash cdot\; 7^1\; =\; 8\; \backslash cdot\; 9\; \backslash cdot\; 7\; =\; 504.$
This method is not as efficient as reducing to the greatest common divisor, since there is no known general efficient algorithm for

_{1}, ''x''_{2}, ..., ''x''_{''n''}), ''n'' > 1. The algorithm proceeds in steps as follows: on each step ''m'' it examines and updates the sequence ''X''^{(''m'')} = (''x''_{1}^{(''m'')}, ''x''_{2}^{(''m'')}, ..., ''x''_{''n''}^{(''m'')}), ''X''^{(1)} = ''X'', where ''X''^{(''m'')} is the ''m''th 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 ''x''_{''k''0}^{(''m'')} is the selected element, the sequence ''X''^{(''m''+1)} is defined as
: ''x''_{''k''}^{(''m''+1)} = ''x''_{''k''}^{(''m'')}, ''k'' ≠ ''k''_{0}
: ''x''_{''k''0}^{(''m''+1)} = ''x''_{''k''0}^{(''m'')} + ''x''_{''k''0}^{(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.

_{2}, ''n''_{3}, ... are non-negative integers; for example, 84 = 2^{2} 3^{1} 5^{0} 7^{1} 11^{0} 13^{0} ...
Given two positive integers $a\; =\; \backslash prod\_p\; p^$ and $b\; =\; \backslash prod\_p\; p^$, their least common multiple and greatest common divisor are given by the formulas
:$\backslash gcd(a,b)\; =\; \backslash prod\_p\; p^$
and
:$\backslash operatorname(a,b)\; =\; \backslash prod\_p\; p^.$
Since
:$\backslash min(x,y)\; +\; \backslash max(x,y)\; =\; x\; +\; y,$
this gives
:$\backslash gcd(a,b)\; \backslash operatorname(a,b)\; =\; ab.$
In fact, every rational number can be written uniquely as the product of primes, if negative exponents are allowed. When this is done, the above formulas remain valid. For example:
:$\backslash begin\; 4\; \&=\; 2^2\; 3^0,\; \&\; 6\; \&=\; 2^1\; 3^1,\; \&\; \backslash gcd(4,\; 6)\; \&=\; 2^1\; 3^0\; =\; 2,\; \&\; \backslash operatorname(4,6)\; \&=\; 2^2\; 3^1\; =\; 12.\; \backslash \backslash ;\; href="/html/ALL/l/pt.html"\; ;"title="pt">pt$

number theory
Number theory (or arithmetic or higher arithmetic in older usage) is a branch of pure mathematics devoted primarily to the study of the integers and integer-valued functions. German mathematician Carl Friedrich Gauss (1777–1855) said, "Mathe ...

, the least common multiple, lowest common multiple, or smallest common multiple of two integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...

s ''a'' and ''b'', usually denoted by lcm(''a'', ''b''), is the smallest positive integer that is divisible
In mathematics, a divisor of an integer n, also called a factor of n, is an integer m that may be multiplied by some integer to produce n. In this case, one also says that n is a multiple of m. An integer n is divisible or evenly divisible by ...

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'', since 0 is the only common multiple of ''a'' and 0.
The lcm is the " lowest common denominator" (lcd) that can be used before fractions
A fraction (from la, fractus, "broken") represents a part of a whole or, more generally, any number of equal parts. When spoken in everyday English, a fraction describes how many parts of a certain size there are, for example, one-half, eight ...

can be added, subtracted or compared.
The least common multiple of more than two integers ''a'', ''b'', ''c'', . . . , usually denoted by lcm(''a'', ''b'', ''c'', . . .), is also well defined: It is the smallest positive integer that is divisible by each of ''a'', ''b'', ''c'', . . .
Overview

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.Notation

The least common multiple of two integers ''a'' and ''b'' is denoted as lcm(''a'', ''b''). Some older textbooks use 'a'', ''b''Example

:$\backslash operatorname(4,\; 6)$ Multiples of 4 are: :$4,\; 8,\; 12,\; 16,\; 20,\; 24,\; 28,\; 32,\; 36,\; 40,\; 44,\; 48,\; 52,\; 56,\; 60,\; 64,\; 68,\; 72,\; 76,\; ...$ Multiples of 6 are: :$6,\; 12,\; 18,\; 24,\; 30,\; 36,\; 42,\; 48,\; 54,\; 60,\; 66,\; 72,\; ...$ ''Common multiples'' of 4 and 6 are the numbers that are in both lists: :$12,\; 24,\; 36,\; 48,\; 60,\; 72,\; ...$ In this list, the smallest number is 12. Hence, the ''least common multiple'' is 12.Applications

When adding, subtracting, or comparing simple fractions, the least common multiple of the denominators (often called the lowest common denominator) is used, because each of the fractions can be expressed as a fraction with this denominator. For example, :$+=+=$ where the denominator 42 was used, because it is the least common multiple of 21 and 6.Gears problem

Suppose there are two meshing gears in a machine, having ''m'' and ''n'' teeth, respectively, and the gears are marked by a line segment drawn from the center of the first gear to the center of the second gear. When the gears begin rotating, the number of rotations the first gear must complete to realign the line segment can be calculated by using $\backslash operatorname(m,\; n)$. The first gear must complete $\backslash operatorname(m,\; n)\backslash over\; m$ rotations for the realignment. By that time, the second gear will have made $\backslash operatorname(m,\; n)\backslash over\; n$ rotations.Planetary alignment

Suppose there are three planets revolving around a star which take ''l'', ''m'' and ''n'' units of time, respectively, to complete their orbits. Assume that ''l'', ''m'' and ''n'' are integers. Assuming the planets started moving around the star after an initial linear alignment, all the planets attain a linear alignment again after $\backslash operatorname(l,\; m,\; n)$ units of time. At this time, the first, second and third planet will have completed $\backslash operatorname(l,\; m,\; n)\backslash over\; l$, $\backslash operatorname(l,\; m,\; n)\backslash over\; m$ and $\backslash operatorname(l,\; m,\; n)\backslash over\; n$ orbits, respectively, around the star.Calculation

Using the greatest common divisor

The least common multiple can be computed from the greatest common divisor (gcd) with the formula :$\backslash operatorname(a,b)=\backslash frac.$ To avoid introducing integers that are larger than the result, it is convenient to use the equivalent formulas :$\backslash operatorname(a,b)=,\; a,\; \backslash ,\backslash frac\; =\; ,\; b,\; \backslash ,\backslash frac\; ,$ where the result of the division is always an integer. These formulas are also valid when exactly one of and is , since . However, if both and are , these formulas would cause division by zero; so, must be considered as a special case. To return to the example above, :$\backslash operatorname(21,6)\; =6\backslash times\backslash frac\; =6\backslash times\backslash frac\; 3\; =6\backslash times\; 7\; =\; 42.$ There are fastalgorithm
In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...

s, such as the Euclidean algorithm for computing the gcd that do not require the numbers to be factored. For very large integers, there are even faster algorithms for the three involved operations (multiplication, gcd, and division); see Fast multiplication
A multiplication algorithm is an algorithm (or method) to multiply two numbers. Depending on the size of the numbers, different algorithms are more efficient than others. Efficient multiplication algorithms have existed since the advent of the de ...

. As these algorithms are more efficient with factors of similar size, it is more efficient to divide the largest argument of the lcm by the gcd of the arguments, as in the example above.
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 ofprime number
A prime number (or a prime) is a natural number greater than 1 that is not a Product (mathematics), product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime ...

s. The prime numbers can be considered as the atomic elements which, when combined, make up a composite number
A composite number is a positive integer that can be formed by multiplying two smaller positive integers. Equivalently, it is a positive integer that has at least one divisor other than 1 and itself. Every positive integer is composite, prime, ...

.
For example:
:$90\; =\; 2^1\; \backslash cdot\; 3^2\; \backslash cdot\; 5^1\; =\; 2\; \backslash cdot\; 3\; \backslash cdot\; 3\; \backslash cdot\; 5.$
Here, the composite number 90 is 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.
This fact can be used to find the lcm of a set of numbers.
Example: lcm(8,9,21)
Factor each number and express it as a product of prime number powers
Powers may refer to:
Arts and media
* ''Powers'' (comics), a comic book series by Brian Michael Bendis and Michael Avon Oeming
** ''Powers'' (American TV series), a 2015–2016 series based on the comics
* ''Powers'' (British TV series), a 200 ...

.
: $\backslash begin\; 8\; \&\; =\; 2^3\; \backslash \backslash \; 9\; \&\; =\; 3^2\; \backslash \backslash \; 21\; \&\; =\; 3^1\; \backslash cdot\; 7^1\; \backslash end$
The lcm will be the product of multiplying the highest power of each prime number together. The highest power of the three prime numbers 2, 3, and 7 is 2integer factorization
In number theory, integer factorization is the decomposition of a composite number into a product of smaller integers. If these factors are further restricted to prime numbers, the process is called prime factorization.
When the numbers are ...

.
The same method can also be illustrated with a Venn diagram
A Venn diagram is a widely used diagram style that shows the logical relation between sets, popularized by John Venn (1834–1923) in the 1880s. The diagrams are used to teach elementary set theory, and to illustrate simple set relationships ...

as follows, 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.
Here is an example:
: 48 = 2 × 2 × 2 × 2 × 3,
: 180 = 2 × 2 × 3 × 3 × 5,
sharing two "2"s and a "3" in common:
:
: Least common multiple = 2 × 2 × 2 × 2 × 3 × 3 × 5 = 720
: Greatest common divisor = 2 × 2 × 3 = 12
This also works for the greatest common divisor (gcd), except that instead of multiplying all of the numbers in the Venn diagram, one multiplies only the prime factors that are in the intersection. Thus the gcd of 48 and 180 is 2 × 2 × 3 = 12.
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'' = (''x''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):
: 4
: 7
: 12
: 21
: 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 smallest prime number, 3 (see below).
Now, assuming that 2 did divide at least one number (as in this example), check if 2 divides again:
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).
Now, multiply the numbers in the top row to obtain the lcm. In this case, it is .
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
In mathematics, the Euclidean algorithm,Some widely used textbooks, such as I. N. Herstein's ''Topics in Algebra'' and Serge Lang's ''Algebra'', use the term "Euclidean algorithm" to refer to Euclidean division or Euclid's algorithm, is an effi ...

to compute the gcd first, and then obtaining the lcm by division.
Formulas

Fundamental theorem of arithmetic

According to the fundamental theorem of arithmetic, every integer greater than 1 can be represented uniquely as a product of prime numbers,up to Two mathematical objects ''a'' and ''b'' are called equal up to an equivalence relation ''R''
* if ''a'' and ''b'' are related by ''R'', that is,
* if ''aRb'' holds, that is,
* if the equivalence classes of ''a'' and ''b'' with respect to ''R'' a ...

the order of the factors:
:$n\; =\; 2^\; 3^\; 5^\; 7^\; \backslash cdots\; =\; \backslash prod\_p\; p^,$
where the exponents ''n''Lattice-theoretic

The positive integers may bepartially ordered
In mathematics, especially order theory, a partially ordered set (also poset) formalizes and generalizes the intuitive concept of an ordering, sequencing, or arrangement of the elements of a set. A poset consists of a set together with a binary ...

by divisibility: if ''a'' divides ''b'' (that is, if ''b'' is an integer multiple
In mathematics, a multiple is the product of any quantity and an integer. In other words, for the quantities ''a'' and ''b'', it can be said that ''b'' is a multiple of ''a'' if ''b'' = ''na'' for some integer ''n'', which is called the multipli ...

of ''a'') write ''a'' ≤ ''b'' (or equivalently, ''b'' ≥ ''a''). (Note that the usual magnitude-based definition of ≤ is not used here.)
Under this ordering, the positive integers become a lattice, with meet given by the gcd and join given by the lcm. The proof is straightforward, if a bit tedious; it amounts to checking that lcm and gcd satisfy the axioms for meet and join. Putting the lcm and gcd into this more general context establishes a duality between them:
:''If a formula involving integer variables, gcd, lcm, ≤ and ≥ is true, then the formula obtained by switching gcd with lcm and switching ≥ with ≤ is also true.'' (Remember ≤ is defined as divides).
The following pairs of dual formulas are special cases of general lattice-theoretic identities.
It can also be shown that this lattice is distributive; that is, lcm distributes over gcd and gcd distributes over lcm:
:$\backslash operatorname(a,\backslash gcd(b,c))\; =\; \backslash gcd(\backslash operatorname(a,b),\backslash operatorname(a,c)),$
:$\backslash gcd(a,\backslash operatorname(b,c))\; =\; \backslash operatorname(\backslash gcd(a,b),\backslash gcd(a,c)).$
This identity is self-dual:
:$\backslash gcd(\backslash operatorname(a,b),\backslash operatorname(b,c),\backslash operatorname(a,c))=\backslash operatorname(\backslash gcd(a,b),\backslash gcd(b,c),\backslash gcd(a,c)).$
Other

* Let ''D'' be the product of ''ω''(''D'') distinct prime numbers (that is, ''D'' issquarefree
In mathematics, a square-free integer (or squarefree integer) is an integer which is divisible by no square number other than 1. That is, its prime factorization has exactly one factor for each prime that appears in it. For example, is square- ...

).
Then
:$,\; \backslash ,\; =\; 3^,$
where the absolute bars , , denote the cardinality of a set.
* If none of $a\_1,\; a\_2,\; \backslash ldots\; ,\; a\_r$ is zero, then
:$\backslash operatorname(a\_1,\; a\_2,\; \backslash ldots\; ,\; a\_r)\; =\; \backslash operatorname(\backslash operatorname(a\_1,\; a\_2,\; \backslash ldots\; ,\; a\_),\; a\_r).$
In commutative rings

The least common multiple can be defined generally overcommutative ring
In mathematics, a commutative ring is a ring in which the multiplication operation is commutative. The study of commutative rings is called commutative algebra. Complementarily, noncommutative algebra is the study of ring properties that are not ...

s as follows: Let ''a'' and ''b'' be elements of a commutative ring ''R''. A common multiple of ''a'' and ''b'' is an element ''m'' of ''R'' such that both ''a'' and ''b'' divide ''m'' (that is, there exist elements ''x'' and ''y'' of ''R'' such that ''ax'' = ''m'' and ''by'' = ''m''). A least common multiple of ''a'' and ''b'' is a common multiple that is minimal, in the sense that for any other common multiple ''n'' of ''a'' and ''b'', ''m'' divides ''n''.
In general, two elements in a commutative ring can have no least common multiple or more than one. However, any two least common multiples of the same pair of elements are associates. In a unique factorization domain
In mathematics, a unique factorization domain (UFD) (also sometimes called a factorial ring following the terminology of Bourbaki) is a ring in which a statement analogous to the fundamental theorem of arithmetic holds. Specifically, a UFD is a ...

, any two elements have a least common multiple. In a principal ideal domain
In mathematics, a principal ideal domain, or PID, is an integral domain in which every ideal is principal, i.e., can be generated by a single element. More generally, a principal ideal ring is a nonzero commutative ring whose ideals are principal, ...

, the least common multiple of ''a'' and ''b'' can be characterised as a generator of the intersection of the ideals generated by ''a'' and ''b'' (the intersection of a collection of ideals is always an ideal).
See also

*Anomalous cancellation
An anomalous cancellation or accidental cancellation is a particular kind of arithmetic procedural error that gives a numerically correct answer. An attempt is made to reduce a fraction by cancelling individual digits in the numerator and denomi ...

*Coprime integers
In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...

* Chebyshev function
Notes

References

* * * * * {{DEFAULTSORT:Least Common Multiple Elementary arithmetic Operations on numbers Number theory