2013-04-17 14:34:39 +08:00

32 lines
501 B
Python

from math import sqrt, log10
def isp(x):
if x == 2:
return True
if x <= 1 or x & 1 == 0:
return False
for i in xrange(3, int(sqrt(x)) + 1, 2):
if x % i == 0:
return False
return True
def test(x):
sqr = int(sqrt((x - 1) / 2))
for i in xrange(1, sqr + 1):
tt = x - 2 * i * i
if isp(tt):
return True
return False
n = 9
while 1:
if not isp(n):
if not test(n):
print n
break
n += 2
#kkkk = input('end')