Adopted new convention from template
This commit is contained in:
parent
1abee1fe66
commit
314ed47f05
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 02 Apr 2021
|
||||
|
||||
@ -9,7 +9,8 @@ Solution for problem 35 of Project Euler
|
||||
https://projecteuler.net/problem=35
|
||||
"""
|
||||
|
||||
from utils import timeit, is_prime
|
||||
from utils import is_prime, timeit
|
||||
|
||||
|
||||
def circular_number(n):
|
||||
n = str(n)
|
||||
@ -18,6 +19,7 @@ def circular_number(n):
|
||||
result.append(int(n[i:] + n[:i]))
|
||||
return result
|
||||
|
||||
|
||||
@timeit("Problem 35")
|
||||
def compute():
|
||||
"""
|
||||
@ -29,7 +31,8 @@ def compute():
|
||||
|
||||
How many circular primes are there below one million?
|
||||
"""
|
||||
circular_primes = []
|
||||
|
||||
ans = []
|
||||
for i in range(2, 1_000_000):
|
||||
if is_prime(i):
|
||||
all_primes = True
|
||||
@ -38,11 +41,11 @@ def compute():
|
||||
all_primes = False
|
||||
break
|
||||
if all_primes:
|
||||
circular_primes.append(i)
|
||||
|
||||
return len(circular_primes)
|
||||
ans.append(i)
|
||||
|
||||
return len(ans)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 35: {compute()}")
|
||||
print(f"Result for Problem 35: {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user