Last active
September 11, 2020 21:16
-
-
Save betaprojects/15023eb4c38612585cdb8a403f2acfb8 to your computer and use it in GitHub Desktop.
Project Euler & HackerRank problem 5 solution: Smallest multiple - solved using 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(a, b): | |
return a // gcd(a, b) * b | |
N = int(input("The LCM for numbers 1 through ")) | |
print ("is", reduce(LCM, range(N//2+1, N+1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment