Steven D'Aprano <steve+pyt...@pearwood.info> added the comment:
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.) ---------- nosy: +steven.daprano _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39479> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com