Problem 45

Goldbach's other conjecture

Problem 47

Goldbach's other conjecture

Problem 46

It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a prime and twice a square.
9 = 7 + 2×12
15 = 7 + 2×22
21 = 3 + 2×32
25 = 7 + 2×32
27 = 19 + 2×22
33 = 31 + 2×12
It turns out that the conjecture was false.
What is the smallest odd composite that cannot be written as the sum of a prime and twice a square?
from tools import is_prime


def is_conjecture(odd_num):
    square = 0
    while 2 * square**2 < odd_num:
        if is_prime(odd_num - (2 * square**2)):
            return True
        square += 1
    return False


def run():
    odd = 3
    while is_conjecture(odd):
        odd += 2
    return odd