Created
July 12, 2013 12:47
-
-
Save Ayrx/5984196 to your computer and use it in GitHub Desktop.
LCM function for python.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lcm(*numbers): | |
"""Return lowest common multiple.""" | |
def lcm(a, b): | |
return (a * b) // gcd(a, b) | |
return reduce(lcm, numbers, 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment