Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Goldbach's Conjecture - Python Code Bank


Goldbach's Conjecture
Simple script proving Goldbach's Conjecture
                def isPrime(dblIn):
    Prime = False
 
    i=2
    for i in range(2, dblIn):
        if (dblIn%i)==0:
            Prime = False
            break
    else:
        Prime = True
 
 
    if dblIn==1:
        Prime = False
    elif (dblIn==2):
        Prime = True
 
    return Prime
 
dblTest = int(raw_input("Enter an even integer greater than two: \n").strip().rstrip("\n"))
 

for x in range(2,dblTest):
    if isPrime(x) and isPrime(dblTest-x):
        print "=", x," + ", (dblTest-x)
        break

            
Comments
Sorry but there are no comments to display