Skip to content

Instantly share code, notes, and snippets.

Created June 5, 2017 16:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
from sympy import sieve
def goldbach():
For each even number > 2,
it finds a pair of two primes that add up to the number
even = 4
printed = False
if sieve._list[-1] < even:
sieve.extend(even * 2)
for a in sieve._list:
for b in sieve._list:
if a + b == even:
print('{} = {} + {}'.format(even, a, b))
even += 2
printed = True
if printed:
if not printed:
print('{} is a counterexample!'.format(even))
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment