from tools import number_theory
import time
time.clock()

def match(x, prime):
    for base in range(1, int(((x - 3) // 2) ** 0.5) + 1):
        if x - 2 * base * base in prime:
            return True
    return False

def search(limit):
    prime = list(number_theory.make_prime(limit))
    for x in range(21, limit, 2):
        if x in prime:
            continue
        if not match(x, prime):
            return x

print(search(10000))
print(time.clock())