Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

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