0

I'm need to use the Goldbach Conjecture to write a program that gets an even number greater than 2 from the user, that checks to make sure it's even and greater than two, and then finds two prime numbers that sum to the user's number. I've tried so many different ways, but I just can't seem to get it. I know how to do the first part, but it's the part where you need to find two prime numbers that sum up to the user's number that I can't get.
Please, if you could help I would very much appreciate it. Here's the part that actually works:

while True:
    numb = raw_input('Input an even number, greater than 2, or press Q to end: ')
    if numb == 'q':
        print 'end.'
        break
    if numb == 'Q':
        print 'end.'
        break
    else:
        number = int(num)
    if number<3 or number%2 != 0:
        print 'That is not greater than 2 and even, try again.'
        continue

(I don't need any fixes on this part)

Edited by sbutler0311: n/a

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by pyTony
0

Then generate primes, produce squares of them and then check through squared_primes in loop if number - squared_prime is in squared_primes.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.