This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Ananthakrishnan, lemburg, mark.dickinson, rhettinger, steven.daprano, stutzbach, vstinner
Date 2020-01-28.14:26:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580221571.52.0.695755214424.issue39479@roundup.psfhosted.org>
In-reply-to
Content
Uses for lcm are common enough that it is provided by Excel and the C++ boost. You can use it for working out problems like:

- if event A happens every 14 days, and event B happens every 6 days, then A and B will occur together even lcm(14, 6) days.


By the way, the "trivial" implementation given in the Stackoverflow link has a bug: if both arguments are zero, it raises instead of returning zero.

I wish that gcd took an arbitrary number of arguments, I often need to find the gcd of three or more numbers, and this is a pain:

    gcd(a, gcd(b, gcd(c, gcd(d, e)))))

when I could just say gcd(a, b, c, d, e) and have it work. Likewise of lcm. (For that matter, the gcd of a single number a is just a.)
History
Date User Action Args
2020-01-28 14:26:11steven.dapranosetrecipients: + steven.daprano, lemburg, rhettinger, mark.dickinson, vstinner, stutzbach, Ananthakrishnan
2020-01-28 14:26:11steven.dapranosetmessageid: <1580221571.52.0.695755214424.issue39479@roundup.psfhosted.org>
2020-01-28 14:26:11steven.dapranolinkissue39479 messages
2020-01-28 14:26:11steven.dapranocreate