Adopted new convention from template
This commit is contained in:
parent
5094e59189
commit
68012b44ce
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python
|
||||||
"""
|
"""
|
||||||
Created on 3 Jan 2020
|
Created on 3 Jan 2020
|
||||||
|
|
||||||
@ -12,6 +12,10 @@ https://projecteuler.net/problem=30
|
|||||||
from utils import timeit
|
from utils import timeit
|
||||||
|
|
||||||
|
|
||||||
|
def power_digit_sum(pow, n):
|
||||||
|
return sum(int(c) ** pow for c in str(n))
|
||||||
|
|
||||||
|
|
||||||
@timeit("Problem 30")
|
@timeit("Problem 30")
|
||||||
def compute():
|
def compute():
|
||||||
"""
|
"""
|
||||||
@ -30,13 +34,11 @@ def compute():
|
|||||||
powers of their digits.
|
powers of their digits.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def power_digit_sum(pow, n):
|
ans = sum(i for i in range(2, 1_000_000) if i == power_digit_sum(5, i))
|
||||||
return sum(int(c)**pow for c in str(n))
|
|
||||||
|
|
||||||
ans = sum(i for i in range(2, 1000000) if i == power_digit_sum(5, i))
|
|
||||||
|
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
print(f"Result for Problem 30: {compute()}")
|
print(f"Result for Problem 30: {compute()}")
|
Loading…
x
Reference in New Issue
Block a user