-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path35.py
More file actions
37 lines (31 loc) · 703 Bytes
/
35.py
File metadata and controls
37 lines (31 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import math
primes = [2,3]
def isPrime(num):
border = math.ceil(math.sqrt(num))
for x in primes:
if x == num:
return True
if num%x == 0:
return False
if x >= border:
return True
def isValid(num):
print("num ",num)
circle = len(str(num))-1
divisor = pow(10,circle)
for x in range(0,circle):
num = 10*(num%divisor) + math.floor(num/divisor)
#print("var ",var)
if not isPrime(num):
return False
return True
circleNums = []
for z in range(5,10000000,2):
if isPrime(z):
primes.append(z)
for p in primes:
if p<1000000 and isValid(p):
circleNums.append(p)
#print(primes)
print(circleNums)
print("Numbers of round ",len(circleNums))