Skip to content

Commit

Permalink
add euler035 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
kailanefelix committed Sep 25, 2021
1 parent cc8ab8c commit 8fdf81c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions euler0XX/euler035.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from primality import is_prime
import time

def rotations(s: str):
for i in range(1, len(s)):
yield s[i:] + s[:i]

start = time.process_time()

count = 4
for number in range(11, 1000000, 2):
if is_prime(number) and all(is_prime(int(rotation)) for rotation in rotations(str(number))):
count = count + 1

elapsed_time = time.process_time() - start

print(count, f'{elapsed_time * 1000:.3f} ms')

0 comments on commit 8fdf81c

Please sign in to comment.