A338274 Number of decompositions of 2*n >= 4 into an unordered sum of two primes, n - d and n + d, such that d < sqrt(2*n - 1).
1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 0, 2, 1, 1, 1, 1, 0, 1, 2, 1, 0, 1, 1, 1, 2, 2, 0, 2, 1, 1, 2, 1, 1, 2, 0, 2, 1, 0, 2, 2, 1, 2, 1, 0, 1, 2, 0, 1, 2, 1, 1, 2, 1, 1, 2, 2, 0, 2, 2, 1, 2, 2, 0, 2, 1, 1, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 1
Offset: 2
Keywords
Examples
a(2) = 1 because 2*n = 2 + 2 and d = 0 < sqrt(2*2 - 1); a(5) = 2 because 2*n = 5 + 5 = 3 + 7 and both d's ( 0 and 2) < sqrt(2*5 - 1); a(22) = 0 because none of the values of d (9, 15 and 19) for the three Goldbach pairs of 2*22 (13&31, 7&37 and 3&41) is < sqrt(2*22 - 1); a(105) = 3 because the values of d (2, 4, and 8) for 3 of the 19 Goldbach pairs are < sqrt(2*105 - 1).
Programs
-
Python
from sympy import isprime from math import sqrt m = 2 while m >= 2: d = 0 a = 0 while d < sqrt(2*m - 1): p = m - d q = m + d if isprime(p) == 1 and isprime(q) == 1: a += 1 d += 1 print (a) m += 1
Comments