22 lines
475 B
Python
22 lines
475 B
Python
|
|
from tools import number_theory
|
|
|
|
def roll(num):
|
|
s = str(num)
|
|
for i in range(len(s)):
|
|
yield int(s[i:] + s[:i])
|
|
|
|
def find_roll_prime(limit):
|
|
count = 13
|
|
prime = list(number_theory.make_prime(limit))[25:]
|
|
prime = list(filter(lambda x: ('5' not in str(x)), prime))
|
|
for p in prime:
|
|
for x in roll(p):
|
|
if x not in prime:
|
|
break
|
|
else:
|
|
count += 1
|
|
return count
|
|
|
|
print(find_roll_prime(1000000))
|