Here we verify the conjecture for small numbers.

§1. On 7 June 1742, Christian Goldbach wrote a letter from Moscow to Leonhard Euler in Berlin making "eine conjecture hazardiren" that every even number greater than \(2\) can be written as a sum of two primes.1 Euler did not know if this was true, and nor does anyone else.

Letter.jpg

Goldbach, a professor at St Petersburg and tutor to Tsar Peter II, wrote in several languages in an elegant cursive script, and was much valued as a letter-writer, though his reputation stands less high today.2 All the same, the general belief now is that primes are just plentiful enough, and just evenly-enough spread, for Goldbach to be right. It is known that:

§2. Computer verification has been made up to around \(10^{18}\), but by rather better methods than the one we use here. We will only go up to:

define RANGE 100
#include <stdio.h>

int main(int argc, char *argv[]) {
    for (int i=4; i<RANGE; i=i+2)  stepping in twos to stay even
        Solve Goldbach's conjecture for i2.1;
}

§2.1. This ought to print:

    $ goldbach/Tangled/goldbach
    4 = 2+2
    6 = 3+3
    8 = 3+5
    10 = 3+7 = 5+5
    12 = 5+7
    14 = 3+11 = 7+7
    ...

We'll print each different pair of primes adding up to \(i\). We only check in the range \(2 \leq j \leq i/2\) to avoid counting pairs twice over (thus \(8 = 3+5 = 5+3\), but that's hardly two different ways).

Solve Goldbach's conjecture for i2.1 =

    printf("%d", i);
    for (int j=2; j<=i/2; j++)
        if ((isprime(j)) && (isprime(i-j)))
            printf(" = %d+%d", j, i-j);
    printf("\n");