This article has been dead for over three months
You
def primes(n):
""" primitive non-sieve prime finder """
p = [2]
for i in range(3,n+1,2):
if all(i % pr for pr in p):
p.append(i)
return p
def possible_sums(seq, limit):
return set(a+b for ind, a in enumerate(seq) for b in seq[ind:] if a+b <= limit)
def test_sum(limit=10000):
# 4 is only with sum of two even primes == 2 + 2, testing from 6 until limit
print('''
Testing that even numbers from 6 until %i are expressable by
not necessary different pair of odd primes
(4 = 2 + 2 is only even case)...
''' % limit)
not_ok = set(range(6, limit, 2)) - (possible_sums(primes(limit)[1:], limit))
print('Test passed' if not not_ok else 'No prime sum for '+str(not_ok))
if __name__ == '__main__':
test_sum()