Skip to content

Instantly share code, notes, and snippets.

@pqcfox
Created February 6, 2015 00:00
Show Gist options
  • Select an option

  • Save pqcfox/4147e8b87b015ff21614 to your computer and use it in GitHub Desktop.

Select an option

Save pqcfox/4147e8b87b015ff21614 to your computer and use it in GitHub Desktop.
Naive LCM finder.
import sys
def lcm(a, b):
bigger = max(a, b)
lcm = bigger
while lcm % a != 0 or lcm % b != 0:
lcm += bigger
return lcm
a, b = [int(k) for k in sys.argv[1:3]]
print(lcm(a, b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment