Toying with a lesser known Goldbach Conjecture…

Published on 2006-09-05 by Mark VandeWettering

While reading Beiler’s Recreations in the Theory of Numbers, I ran across this rather odd conjecture attributed to Goldbach: that all odd numbers are either prime, or can be expressed as the sum of a prime and twice a square. That seemed rather interesting. There were two known exceptions, in particular 5777 and 5993, which could not be so expressed. It turns out that even among primes, most primes can be written as a similar sum. Those that cannot are apparently called “Stern Primes”. I thought that I’d write a little Python gizmo to check that out.

Sure enough, one small Python script later, and 3m49s of runtime, we get….

3 is not the sum of a prime and twice a square
17 is not the sum of a prime and twice a square
137 is not the sum of a prime and twice a square
227 is not the sum of a prime and twice a square
977 is not the sum of a prime and twice a square
1187 is not the sum of a prime and twice a square
1493 is not the sum of a prime and twice a square
5777 is not the sum of a prime and twice a square
5993 is not the sum of a prime and twice a square

The first eight are all prime (in fact, the only known Stern primes). The last two are composite.
There are no other such numbers smaller than ten million (yes, the script tried them all).

You can read more about this conjecture here and the WIkipedia entry on Stern primes here.

[tags]Mathematics[/tags]

Addendum: I rewrote the program in C, and ran it up until max value = 1,073,741,824. The C version took only 1m41s on my faster workstation, and verified that there were no additional odd numbers that could not be so expressed that were smaller than 2^30th.