Adopted new convention from template
This commit is contained in:
parent
836d22e271
commit
6912146be7
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 23 Apr 2017
|
||||
|
||||
@ -9,7 +9,8 @@ Solution for problem 5 of Project Euler
|
||||
https://projecteuler.net/problem=5
|
||||
"""
|
||||
|
||||
import math
|
||||
from math import gcd
|
||||
|
||||
from utils import timeit
|
||||
|
||||
# The LCM of two natural numbers x and y is given by:
|
||||
@ -29,13 +30,13 @@ def compute():
|
||||
What is the smallest positive number that is evenly divisible by all of
|
||||
the numbers from 1 to 20?
|
||||
"""
|
||||
|
||||
ans = 1
|
||||
for i in range(1, 21):
|
||||
ans *= i // math.gcd(i, ans)
|
||||
ans *= i // gcd(i, ans)
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for problem 5: {compute()}")
|
||||
print(f"Result for problem 5 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user