Math Day 6:
Goldbach Conjecture Trial in Python:
Because of the dramatical story of Chen jing run(陈景润), Chinese society has a special sentimental enthusiasm attached to the Goldbach Conjecture. Majority of the public think it is the most difficult and fascinating maths problem in the world.
The truth is Goldbach Conjecture is extremely easy to understand, yet remains unproven.
Goldbach’s Conjecture. Every even integer greater than 2 is the sum of two primes.
Example:
4=2+2, 6=3+3, 18=7+11…
Background Story:
In 1742, Christian Goldbach, an amateur mathematician, sent a letter to Leonhard Euler(e^i*π+1=0) in which he made the following conjecture:
Every even number greater than 4 can be
written as the sum of two odd prime numbers.
Euler didn’t take the letter seriously, regarding the result as trivial. I guess super wise man makes mistakes once a while, because the Goldbach conjecture, has not proven in 2019.
in 2013, Zhang Yi Tang has established the first finite bound on the least gap between consecutive primes, which is a step closer to prove Twin- Prime conjecture, which may lead to the prove of Goldbach conjecture.

aingnamma / Pixabay
While I was in school, I m not considered as the top smart student’s category, however, I am definitely smart enough to NOT try to prove the Goldbach Conjecture. While “sitting there doing nothing” is not my style either, so I decided to execute the Goldbach Conjecture in Python.
Goldbach Conjecture Python Trial:
#GoldBach Conjecture import math MAX=10000; primes=[]; def sieveSundaram(): marked=[False]*(int(MAX/2)+100); for i in range(1, int((math.sqrt(MAX)-1)/2)+1): for j in range((i*(i+1))<< 1, int(MAX/2)+1, 2*i+1): marked[j]=True; primes.append(2); for i in range(1, int(MAX/2)+1): if (marked[i]==False): primes.append(2*i+1); def findPrimes(n): if (n <=2 or n % 2 !=0): print("Even Number"); return; i=0; while (primes[i] <= n //2): diff=n-primes[i]; if diff in primes: print(primes[i], "+", diff, "=", n); return; i+=1; sieveSundaram(); findPrimes(4); findPrimes(22); #This code is contributed by chandan_jnu
Output:
findPrimes(4); 2 + 2 = 4 findPrimes(22); 3 + 19 = 22 findPrimes(5000); 7 + 4993 = 5000 findPrimes(8800); 17 + 8783 = 8800 findPrimes(9998); 31 + 9967 = 9998
Personal Thoughts:
I have a bad habit, watching too much TV shows. Whenever maths is involved in the TV reality shows, the hosts always comments “OMG, so hard, genius” or “what is your opinion about the Goldbach Conjecture ?”. No doubt there are many genius in science, mathematics in particular, but all of them has to work hard. In addition, there are many worldwide maths problems such as Fermat’s Last Theorem (solved in 1993, Wiles ). Riemannian Hypothesis, Navier-Stroke,
P vs NP problem, Poincare Conjecture(solved in 2003 by Perelman), Twin Prime Conjecture worth our attention as well….
Happy Practicing!
Reference:
https://web.stanford.edu/class/cs97si/probs/2262.htm
https://en.wikipedia.org/wiki/Yitang_Zhang
https://www.geeksforgeeks.org/program-for-goldbachs-conjecture-two-primes-with-given-sum/