Adopted new convention from template
This commit is contained in:
parent
b36423bd9c
commit
6b55d7b25e
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 09 Apr 2021
|
||||
|
||||
@ -9,7 +9,8 @@ Solution for problem 37 of Project Euler
|
||||
https://projecteuler.net/problem=37
|
||||
"""
|
||||
|
||||
from utils import timeit, list_primes, is_prime
|
||||
from utils import is_prime, list_primes, timeit
|
||||
|
||||
|
||||
def is_truncatable_prime(number):
|
||||
num_str = str(number)
|
||||
@ -19,6 +20,7 @@ def is_truncatable_prime(number):
|
||||
|
||||
return True
|
||||
|
||||
|
||||
@timeit("Problem 37")
|
||||
def compute():
|
||||
"""
|
||||
@ -32,15 +34,16 @@ def compute():
|
||||
|
||||
NOTE: 2, 3, 5, and 7 are not considered to be truncatable primes.
|
||||
"""
|
||||
|
||||
ans = 0
|
||||
primes = list_primes(1_000_000)
|
||||
# Statement of the problem says this
|
||||
for number in primes[4:]:
|
||||
if is_truncatable_prime(number):
|
||||
ans += number
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 37: {compute()}")
|
||||
print(f"Result for Problem 37 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user