diff --git a/5_lcm.py b/5_lcm.py new file mode 100644 index 0000000..649f379 --- /dev/null +++ b/5_lcm.py @@ -0,0 +1,12 @@ +def gcd(a,b): + while b: + a,b=b,a%b + return a + +def lcm(a,b): + return (a*b)//gcd(a,b) + +x=1 +for i in range(2,21): + x=lcm(x,i) +print(x)