Goldbach's Other Conjecture¶

We can write a function that takes odd composites $m$ and checks successively larger values of $n$ to see if $m - 2n^2$ is prime. If we find such an $n$, $m$ satisfies the conjecture, but if $n$ gets too large, $m - 2n^2$ will become non-positive, and therefore can't be prime, so $m$ fails to satisfy the conjecture.

In [1]:
from itertools import count

def satisfies_conjecture(m):
    for n in count(1):
        p = m - 2 * n^2
        if p <= 0:
            return False
        
        if is_prime(p):
            return True


for k in count(2):
    m = 2 * k - 1
    if is_prime(m):
        continue
        
    if not satisfies_conjecture(m):
        break

m
Out[1]:
5777

Interestingly, the only other number known not to satisfy this conjecture is 5993.

Relevant sequences¶

  • Stern numbers (includes all odd numbers, not just composites): A060003

Copyright (C) 2025 filifa¶

This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license and the BSD Zero Clause license.