Created
February 6, 2015 00:00
-
-
Save pqcfox/4147e8b87b015ff21614 to your computer and use it in GitHub Desktop.
Naive LCM finder.
This file contains hidden or 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
| 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