Adopted new convention from template
This commit is contained in:
parent
3c0993b179
commit
1abee1fe66
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 02 Apr 2021
|
||||
|
||||
@ -9,7 +9,8 @@ Solution for problem 34 of Project Euler
|
||||
https://projecteuler.net/problem=34
|
||||
"""
|
||||
|
||||
import math
|
||||
from math import factorial
|
||||
|
||||
from utils import timeit
|
||||
|
||||
|
||||
@ -26,10 +27,10 @@ def compute():
|
||||
|
||||
ans = 0
|
||||
|
||||
for num in range(10,2540160):
|
||||
for num in range(10, 2_540_160):
|
||||
sum_of_factorial = 0
|
||||
for digit in str(num):
|
||||
sum_of_factorial += math.factorial(int(digit))
|
||||
sum_of_factorial += factorial(int(digit))
|
||||
if sum_of_factorial == num:
|
||||
ans += sum_of_factorial
|
||||
|
||||
@ -37,5 +38,4 @@ def compute():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 34: {compute()}")
|
||||
print(f"Result for Problem 34 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user