def gcd(a, b):
while b:
a, b = b, a % b
return a
def lcm(a, b):
return max(a, b) // gcd(a, b) * min(a, b)
ans = 1
for i in range(2, 20+1):
ans = lcm(ans, i)
print(ans)
Created
February 7, 2015 13:40
-
-
Save amoshyc/741f915c66782504d896 to your computer and use it in GitHub Desktop.
Project Euler #5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment