First of all, let us get some better implementation in sageof the routine counting the number r(K), (K>2 some even integer,) of the solutions for
p+q=2k , p,q prime numbers.
(We will count both solutions (p,q) and (q,p), when p,q differ.)
def r(K):
if K not in ZZ or K <= 2 or K % 2:
return None
if K == 4:
return 1
count = 0
for p in primes(3, K):
for q in primes(3, K + 1 - p):
if p + q == K:
count += 1
return count
goldbach_points = [(K, r(K)) for K in range(4, 100,2)]
show(points(goldbach_points))
This gives:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…