-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheuler37.py
More file actions
executable file
·44 lines (32 loc) · 751 Bytes
/
Copy patheuler37.py
File metadata and controls
executable file
·44 lines (32 loc) · 751 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
38
39
40
41
42
43
44
from prime import primes
from re import search
def frontback(n):
value = str(n)
list = []
while value:
list.append(int(value))
value = value[:-1]
value = str(n)
value = value[::-1]
value = value[:-1]
while value:
list.append(int(value[::-1]))
value = value[:-1]
return list
primelist = primes(1000000)
truncprime = []
for i in primelist:
if (search('[245680]', str(i))) and i > 100:
continue
if (set(frontback(i)) < set(primelist)) and i not in [2,3,5,7]:
truncprime.append(i)
total = 0
for n in truncprime:
total += n
print total
'''
n = 3137
print frontback(n)
if (set(frontback(n)) < set(primelist)) and n not in [2,3,5,7]:
print "yes"
'''