from lib_prime import is_prime def euler_046(): n_max = 10000 twice_squares = [2 * n * n for n in range(1, n_max + 1)] def test_conjecture(n): for ts in twice_squares: if ts > n: return False if is_prime(n - ts): return True for n in range(3, n_max + 1, 2): if not is_prime(n) and test_conjecture(n) is False: return n if __name__ == "__main__": print("e046.py: " + str(euler_046())) assert(euler_046() == 5777)