```
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()
```

About the Author

**Are you able to help answer this sponsored question?**

Questions asked by members who have earned a lot of community kudos are featured in order to give back and encourage quality replies.

Recommended Articles