Tuesday, October 2, 2018

An Empirical Look at the Goldbach Conjecture

The Goldbach conjecture says that every even number bigger than 2 is the sum of two primes. I imagine he tried out his idea on numbers up to a certain point and guessed that he could keep going. He lived in the 18th century, so he would have done all his calculation by hand. What might he have done if he could have written a Python program?

Let's start with a list of primes, say the first 100 primes. The 100th prime is p = 541. If an even number less than p is the sum of two primes, it's the sum of two primes less than p. So by looking at the sums of pairs of primes less than p, we'll know whether the Goldbach conjecture is true for numbers less than p. And while we're at it, we could keep track not just of whether a number is the sum of two primes, but also how many ways it is a sum of two primes.



from DZone.com Feed https://ift.tt/2y55LUh

No comments:

Post a Comment