Find LCM of 2 numbers without using GCD
|
07-30-2018, 06:13 PM
Post: #7
|
|||
|
|||
RE: Find LCM of 2 numbers without using GCD
(07-30-2018 04:41 PM)Thomas Klemm Wrote: But then why not using Jean-Marc Baillard's solution: GCD? Exactly ! Why brute force LCM ? For lcm(54321, 12345), a simple gcd derived lcm is 2600X faster ! (Speed relative to the no modulus brute forced lcm, post #3) Code: def gcd(a, b): |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)