I've been asked to write a piece of code that checks that Goldbach's conjecture holds for every even number up to N, so far I have the following:
def gb(n):
#give a list of all primes less than n using the sieve of Eratosthenes (not considering 1 to be prime like Goldbach):
primes=list(range(2,n+1))
for i in primes:
j=2
while i*j<=primes[-1]:
if i*j in primes :
primes.remove(i*j)
j=j+1
#give a list of even numbers less than n but starting from 4
evens=list(range(4,n+1,2))
I then need to check if all the numbers in evens can be made as the sum of two numbers in primes. I'm confused at this point, I know that I need to use loops but I'm not sure as to how to check if all of them fit the conjecture?