2017-08-16 22:54:45 +08:00

17 lines
458 B
Python

from tools import number_theory
def same(x, y):
return str(sorted(str(x))) == str(sorted(str(y)))
def search(limit):
prime = list(filter(lambda x: x > 1487, number_theory.make_prime(limit)))
for i, pi in enumerate(prime):
for pj in prime[i + 1:]:
if same(pi, pj):
pn = 2 * pj - pi
if same(pn, pi) and pn in prime:
return str(pi) + str(pj) + str(pn)
print(search(10000))