Skip to content

Instantly share code, notes, and snippets.

@soimort
Created March 5, 2012 15:47
Show Gist options
  • Save soimort/1978917 to your computer and use it in GitHub Desktop.
Save soimort/1978917 to your computer and use it in GitHub Desktop.
Project Euler - Problem 5
def gcd(a, b):
if a:
return gcd(b % a, a)
else:
return b
lcm = lambda a, b: a * b // gcd(a, b)
m = 1
for i in range(2, 21):
m = lcm(m, i)
print(m)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment