Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Least common multiple
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Smallest positive number divisible by two integers}} [[File:Symmetrical_5-set_Venn_diagram_LCM_2_3_4_5_7.svg|thumb|250px|A [[Venn diagram]] showing the least common multiples of all subsets of {2, 3, 4, 5, 7}.]] In [[arithmetic]] and [[number theory]], the '''least common multiple''', '''lowest common multiple''', or '''smallest common multiple''' of two [[integer]]s ''a'' and ''b'', usually denoted by {{nowrap|lcm(''a'', ''b'')}}, is the smallest positive integer that is [[divisible]] by both ''a'' and ''b''.<ref name=":1">{{Cite web|last=Weisstein|first=Eric W.|title=Least Common Multiple|url=https://mathworld.wolfram.com/LeastCommonMultiple.html|access-date=2020-08-30|website=mathworld.wolfram.com|language=en}}</ref><ref>Hardy & Wright, Β§ 5.1, p. 48</ref> Since [[Division by zero|division of integers by zero]] is undefined, this definition has meaning only if ''a'' and ''b'' are both different from zero.<ref name="auto">{{harvtxt|Long|1972|p=39}}</ref> However, some authors define lcm(''a'', 0) as 0 for all ''a'', since 0 is the only common multiple of ''a'' and 0. The least common multiple of the denominators of two [[Fraction (mathematics)|fractions]] is the "[[lowest common denominator]]" (lcd), and can be used for adding, subtracting or comparing the fractions. The least common multiple of more than two integers ''a'', ''b'', ''c'', . . . , usually denoted by {{nowrap|lcm(''a'', ''b'', ''c'', . . .)}}, is defined as the smallest positive integer that is divisible by each of ''a'', ''b'', ''c'', . . .<ref name=":1" /> == Overview == A [[Multiple (mathematics)|multiple]] of a number is the [[product (mathematics)|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'').<ref name=":1" /> Some older textbooks use [''a'', ''b''].<ref name="auto"/><ref>{{harvtxt|Pettofrezzo|Byrkit|1970|p=56}}</ref> === Example === :<math>\operatorname{lcm}(4, 6)</math> Multiples of 4 are: :<math> 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, ...</math> Multiples of 6 are: :<math> 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, ...</math> ''Common multiples'' of 4 and 6 are the numbers that are in both lists: :<math> 12, 24, 36, 48, 60, 72, ...</math> In this list, the smallest number is 12. Hence, the ''least common multiple'' is 12. == Applications == When adding, subtracting, or comparing [[simple fraction]]s, 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, :<math>{2\over21}+{1\over6}={4\over42}+{7\over42}={11\over42}</math> where the denominator 42 was used, because it is the least common multiple of 21 and 6. === Gears problem === Suppose there are two [[Gear|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 <math>\operatorname{lcm}(m, n)</math>. The first gear must complete <math>\operatorname{lcm}(m, n)\over m</math> rotations for the realignment. By that time, the second gear will have made <math>\operatorname{lcm}(m, n)\over n</math> rotations. === Planetary alignment === {{See also|Syzygy (astronomy)}} 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 <math>\operatorname{lcm}(l, m, n)</math> units of time. At this time, the first, second and third planet will have completed <math>\operatorname{lcm}(l, m, n)\over l</math>, <math>\operatorname{lcm}(l, m, n)\over m</math> and <math>\operatorname{lcm}(l, m, n)\over n</math> orbits, respectively, around the star.<ref>{{Cite web|url=https://spacemath.gsfc.nasa.gov/weekly/6Page41.pdf|title=nasa spacemath}}</ref> == Calculation == There are several ways to compute least common multiples. === Using the greatest common divisor === The least common multiple can be computed from the [[greatest common divisor]] (gcd) with the formula :<math>\operatorname{lcm}(a,b)=\frac{|ab|}{\gcd(a,b)}.</math> To avoid introducing integers that are larger than the result, it is convenient to use the equivalent formulas :<math>\operatorname{lcm}(a,b)=|a|\,\frac{|b|}{\gcd(a,b)} = |b|\,\frac{|a|}{\gcd(a,b)} ,</math> where the result of the division is always an integer. These formulas are also valid when exactly one of {{math|''a''}} and {{math|''b''}} is {{math|0}}, since {{math|1=gcd(''a'', 0) = {{abs|''a''}}}}. However, if both {{math|''a''}}{{math|}} and {{math|''b''}} are {{math|0}}, these formulas would cause [[division by zero]]; so, {{math|1=lcm(0, 0) = 0}} must be considered as a special case. To return to the example above, :<math>\operatorname{lcm}(21,6) =6\times\frac {21}{\gcd(21,6)} =6\times\frac {21} 3 =6\times 7 = 42. </math> There are fast [[algorithm]]s, such as the [[Euclidean algorithm]] for computing the gcd that do not require the numbers to be [[Integer factorization|factored]]. For very large integers, there are even faster algorithms for the three involved operations (multiplication, gcd, and division); see [[Fast multiplication]]. 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 [[fundamental theorem of arithmetic|unique factorization theorem]] indicates that every positive integer greater than 1 can be written in only one way as a product of [[prime number]]s. The prime numbers can be considered as the atomic elements which, when combined, make up a [[composite number]]. For example: :<math>90 = 2^1 \cdot 3^2 \cdot 5^1 = 2 \cdot 3 \cdot 3 \cdot 5. </math> 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 [[Power (mathematics)|powers]]. : <math> \begin{align} 8 & = 2^3 \\ 9 & = 3^2 \\ 21 & = 3^1 \cdot 7^1 \end{align} </math> 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 2<sup>3</sup>, 3<sup>2</sup>, and 7<sup>1</sup>, respectively. Thus, :<math>\operatorname{lcm}(8,9,21) = 2^3 \cdot 3^2 \cdot 7^1 = 8 \cdot 9 \cdot 7 = 504. </math> This method is not as efficient as reducing to the greatest common divisor, since there is no known general efficient algorithm for [[integer factorization]]. The same method can also be illustrated with a [[Venn diagram]] 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: :[[Image:least common multiple.svg|400px]] : Least common multiple = 2 Γ 2 Γ 2 Γ 2 Γ 3 Γ 3 Γ 5 = 720 : Greatest common divisor = 2 Γ 2 Γ 3 = 12 : Product = 2 Γ 2 Γ 2 Γ 2 Γ 3 Γ 2 Γ 2 Γ 3 Γ 3 Γ 5 = 8640 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. == 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]] the order of the factors: :<math>n = 2^{n_2} 3^{n_3} 5^{n_5} 7^{n_7} \cdots = \prod_p p^{n_p},</math> where the exponents ''n''<sub>2</sub>, ''n''<sub>3</sub>, ... are non-negative integers; for example, 84 = 2<sup>2</sup> 3<sup>1</sup> 5<sup>0</sup> 7<sup>1</sup> 11<sup>0</sup> 13<sup>0</sup> ... Given two positive integers <math display="inline">a = \prod_p p^{a_p}</math> and <math display="inline">b = \prod_p p^{b_p}</math>, their greatest common divisor and least common multiple are given by the formulas :<math>\gcd(a,b) = \prod_p p^{\min(a_p, b_p)}</math> and :<math>\operatorname{lcm}(a,b) = \prod_p p^{\max(a_p, b_p)}.</math> Since :<math>\min(x,y) + \max(x,y) = x + y,</math> this gives :<math>\gcd(a,b) \operatorname{lcm}(a,b) = ab.</math> 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: :<math>\begin{align} 4 &= 2^2 3^0, & 6 &= 2^1 3^1, & \gcd(4, 6) &= 2^1 3^0 = 2, & \operatorname{lcm}(4,6) &= 2^2 3^1 = 12. \\[8pt] \tfrac{1}{3} &= 2^0 3^{-1} 5^0, & \tfrac{2}{5} &= 2^1 3^0 5^{-1}, & \gcd\left(\tfrac13, \tfrac{2}{5}\right) &= 2^0 3^{-1} 5^{-1} = \tfrac{1}{15}, & \operatorname{lcm}\left(\tfrac{1}{3}, \tfrac{2}{5}\right) &= 2^1 3^0 5^0 = 2, \\[8pt] \tfrac{1}{6} &= 2^{-1} 3^{-1}, & \tfrac{3}{4} &= 2^{-2} 3^1, & \gcd\left(\tfrac{1}{6}, \tfrac{3}{4}\right) &= 2^{-2} 3^{-1} = \tfrac{1}{12}, & \operatorname{lcm}\left(\tfrac{1}{6}, \tfrac{3}{4}\right) &= 2^{-1} 3^1 = \tfrac{3}{2}. \end{align}</math> === Lattice-theoretic === The positive integers may be [[partially ordered]] by divisibility: if ''a'' divides ''b'' (that is, if ''b'' is an [[integer multiple]] 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 (order)|lattice]], with [[meet (mathematics)|meet]] given by the gcd and [[join (mathematics)|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 (order theory)|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. {| style="margin:0;" cellpadding="0" border="0" cellspacing="0" | ;[[commutative operation|Commutative laws]] :<math>\operatorname{lcm}(a, b) = \operatorname{lcm}(b, a),</math> :<math>\gcd(a, b) =\gcd( b, a).</math> | | ;[[associativity|Associative laws]] :<math>\operatorname{lcm}(a,\operatorname{lcm}(b, c)) = \operatorname{lcm}(\operatorname{lcm}(a , b),c),</math> :<math>\gcd(a, \gcd(b, c)) = \gcd(\gcd(a,b), c).</math> | | ;[[Absorption law]]s: :<math>\operatorname{lcm}(a, \gcd(a,b)) = a,</math> :<math>\gcd(a, \operatorname{lcm}(a, b)) = a.</math> |} {| style="margin:0;" cellpadding="0" border="0" cellspacing="0" | ;[[Idempotent|Idempotent laws]] :<math>\operatorname{lcm}(a, a) = a,</math> :<math>\gcd(a, a) = a.</math> | | ;[[Lattice (order)#Connection between the two definitions|Define divides in terms of lcm and gcd]] :<math>a \ge b \iff a = \operatorname{lcm}(a,b),</math> :<math>a \le b \iff a = \gcd(a,b).</math> |} It can also be shown<ref>The next three formulas are from Landau, Ex. III.3, p. 254</ref> that this lattice is [[distributive lattice|distributive]]; that is, lcm distributes over gcd and gcd distributes over lcm: :<math>\operatorname{lcm}(a,\gcd(b,c)) = \gcd(\operatorname{lcm}(a,b),\operatorname{lcm}(a,c)),</math> :<math>\gcd(a,\operatorname{lcm}(b,c)) = \operatorname{lcm}(\gcd(a,b),\gcd(a,c)).</math> This identity is self-dual: :<math>\gcd(\operatorname{lcm}(a,b),\operatorname{lcm}(b,c),\operatorname{lcm}(a,c))=\operatorname{lcm}(\gcd(a,b),\gcd(b,c),\gcd(a,c)).</math> === Other === * Let ''D'' be the product of ''Ο''(''D'') distinct prime numbers (that is, ''D'' is [[squarefree]]). Then<ref>Crandall & Pomerance, ex. 2.4, p. 101.</ref> :<math>|\{(x,y) \;:\; \operatorname{lcm}(x,y) = D\}| = 3^{\omega(D)},</math> where the absolute bars || denote the [[cardinality]] of a set. * If none of <math>a_1, a_2, \ldots , a_r</math> is zero, then :<math>\operatorname{lcm}(a_1, a_2, \ldots , a_r) = \operatorname{lcm}(\operatorname{lcm}(a_1, a_2, \ldots , a_{r-1}), a_r). </math><ref>{{harvtxt|Long|1972|p=41}}</ref><ref>{{harvtxt|Pettofrezzo|Byrkit|1970|p=58}}</ref> == In commutative rings == The least common multiple can be defined generally over [[commutative ring]]s as follows: Let {{mvar|a}} and {{mvar|b}} be elements of a commutative ring {{mvar|R}}. A ''common multiple'' of {{mvar|a}} and {{mvar|b}} is an element {{mvar|m}} of {{mvar|R}} such that both {{mvar|a}} and {{mvar|b}} divide {{mvar|m}} (that is, there exist elements {{mvar|x}} and {{mvar|y}} of {{mvar|R}} such that {{math|''ax'' {{=}} ''m''}} and {{math|''by'' {{=}} ''m''}}). A ''least common multiple'' of {{mvar|a}} and {{mvar|b}} is a common multiple that is minimal, in the sense that for any other common multiple {{mvar|n}} of {{mvar|a}} and {{mvar|b}}, {{mvar|m}} divides {{mvar|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 [[Unit (ring theory)|associates]].{{sfn|Burton|1970|p=94}} In a [[unique factorization domain]], any two elements have a least common multiple.{{sfn|Grillet|2007|p=142}} In a [[principal ideal domain]], the least common multiple of {{mvar|a}} and {{mvar|b}} can be characterised as a generator of the intersection of the ideals generated by {{mvar|a}} and {{mvar|b}}{{sfn|Burton|1970|p=94}} (the intersection of a collection of ideals is always an ideal). == See also == *[[Anomalous cancellation]] *[[Coprime integers]] *[[Chebyshev function]] == Notes == {{Reflist}} == References == *{{Cite book |last= Burton |first= David M. |year= 1970 |title= A First Course in Rings and Ideals |location= Reading, MA |publisher= Addison-Wesley |isbn= 978-0-201-00731-2 }} *{{citation | last1 = Crandall | first1 = Richard | last2 = Pomerance | first2 = Carl | title = Prime Numbers: A Computational Perspective | publisher = [[Springer Science+Business Media|Springer]] | location = New York | year = 2001 | isbn = 0-387-94777-9 | url = https://books.google.com/books?id=8KZ4RQufxhYC}} *{{Cite book |last= Grillet |first= Pierre Antoine |year= 2007 |title= Abstract Algebra |edition= 2nd |location= New York, NY |publisher= Springer |isbn= 978-0-387-71568-1 }} *{{citation | last1 = Hardy | first1 = G. H. | last2 = Wright | first2 = E. M. | title = An Introduction to the Theory of Numbers (Fifth edition) | publisher = [[Oxford University Press]] | location = Oxford | year = 1979 | isbn = 978-0-19-853171-5 | url = https://books.google.com/books?id=3hTeH5VUheAC}} *{{citation | last1 = Landau | first1 = Edmund | title = Elementary Number Theory | publisher = Chelsea | location = New York | year = 1966}} * {{citation | first1 = Calvin T. | last1 = Long | year = 1972 | title = Elementary Introduction to Number Theory | edition = 2nd | publisher = [[D. C. Heath and Company]] | location = Lexington | lccn = 77-171950 }} * {{citation | first1 = Anthony J. | last1 = Pettofrezzo | first2 = Donald R. | last2 = Byrkit | year = 1970 | title = Elements of Number Theory | publisher = [[Prentice Hall]] | location = Englewood Cliffs | lccn = 77-81766 }} {{Fractions and ratios}} {{DEFAULTSORT:Least Common Multiple}} [[Category:Elementary arithmetic]] [[Category:Operations on numbers]] [[Category:Number theory]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Citation
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Fractions and ratios
(
edit
)
Template:Harvtxt
(
edit
)
Template:Math
(
edit
)
Template:Mvar
(
edit
)
Template:Nowrap
(
edit
)
Template:Reflist
(
edit
)
Template:See also
(
edit
)
Template:Sfn
(
edit
)
Template:Short description
(
edit
)