Created
June 20, 2018 02:51
-
-
Save CMCDragonkai/a07e065461bdad06c2ec938a6ba6354a to your computer and use it in GitHub Desktop.
Lowest Common Multiple #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
from math import gcd | |
from functools import reduce | |
def lcm(numbers): | |
return reduce(lambda x, y: int((x * y) / gcd(x, y)), numbers, 1) | |
print(lcm([3,4,2,5,5]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment