Skip to main content

A python approach to GOLDBACH’S CONJESTURE

Goldbach’s conjecture





On 7 June 1742, the German mathematician Christian Goldbach wrote a letter to Leonhard Euler, in  which he proposed the following conjecture.

Goldbach’s conjecture is one of the oldest and best-known unsolved problems in number theory and all of mathematics. 

Every even integer greater than 2 can be expressed as the sum of two primes

What is a conjecture ?😕😕😕

A Conjecture is a conclusion or proposition based on incomplete information, for which no proof or disproof has yet been found.



Goldbach number

A Goldbach number is a positive even integer that can be expressed as the sum of two odd primes. 

Since 4 is the only even number greater than 2 that requires the even prime 2 in order to be written as the sum of two primes, another form of the statement of Goldbach’s conjecture is that all even integers greater than 4 are goldbach numbers.

The conjecture has been shown to hold for all integers less than 4⨯〖10〗^18, but remains unproven considerabl effort.😵

Advantages of python

Click here 👈

Python program for finding primes to represent the conjecture.

def primes(n):

 p=[]

 for i in range(2,n+1):

  for j in range(2,int(i**(1/2))+1):

    if i%j==0:

       break

    else:

       p.append(i)

 return p

def pairs(n):

 p=primes(n)

 a=[]

 for i in range(2,n//2+1):

   if i in p and (n-i) in p:

       a.append([i,n-i])

 return a

n=int(input("Enter the even number: "))

print(pairs(n)) 

print("We can represent ",n,"as",len(pairs(n))," different sum of two primes" )

Python program to representing Goldbach’s conjecture

import matplotlib.pyplot as plt

def primes(n):

 p=[]

 for i in range(2,n+1):

   for j in range(2,int(i**(1/2))+1):

      if i%j==0:

          break

   else:

       p.append(i)

 return p

def pairs(n):

 p=primes(n)

 a=[]

 for i in range(2,n//2+1):

   if i in p and (n-i) in p:

      a.append([i,n-i])

 return len(a)

q=int(input("Enter the number: "))

x=[]

y=[]

for i in range(4,q,2):

   x.append(i)

   y.append(pairs(i))

plt.plot(x,y,"*")

plt.show()



Previous post

Comments

Popular posts from this blog

The Sports Meet...

 Two days sports meet 13&14 September A really wonderfull experience.... It was all by the great effort of George sir. Small portion of the items was on the first day. I got second prize in shotput on the first day itself The running race and javelin through was today and I got second and third prize in that. It was a happy moment for me for getting prize in all items that I had participated. 

Python: the language of future

Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming.