Adopted new convention from template
This commit is contained in:
parent
d671105d79
commit
22ad3dab01
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 15 Sep 2018
|
||||
|
||||
@ -11,9 +11,11 @@ https://projecteuler.net/problem=21
|
||||
|
||||
from utils import timeit
|
||||
|
||||
|
||||
def sum_divisors(n):
|
||||
return sum(i for i in range(1, n // 2 + 1) if n % i == 0)
|
||||
|
||||
|
||||
@timeit("Problem 21")
|
||||
def compute():
|
||||
"""
|
||||
@ -28,7 +30,8 @@ def compute():
|
||||
|
||||
Evaluate the sum of all the amicable numbers under 10000.
|
||||
"""
|
||||
n = 10000
|
||||
|
||||
n = 10_000
|
||||
sum_amicable = 0
|
||||
for i in range(1, n):
|
||||
value = sum_divisors(i)
|
||||
@ -38,5 +41,4 @@ def compute():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 21: {compute()}")
|
||||
print(f"Result for Problem 21 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user