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
(section)
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!
=== 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.
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)