login
a(n) is the greatest difference between m and k, with m, k both prime such that k + m = p + q, where (p, q) is the n-th twin prime pair.
0

%I #12 Sep 20 2024 06:41:48

%S 2,2,14,26,46,74,106,134,194,206,266,286,346,374,382,442,454,506,550,

%T 614,686,818,854,914,1034,1118,1186,1226,1274,1294,1606,1630,1618,

%U 1702,1754,2018,2042,2078,2102,2174,2290,2434,2546,2534,2582,2626,2846,2890,2950

%N a(n) is the greatest difference between m and k, with m, k both prime such that k + m = p + q, where (p, q) is the n-th twin prime pair.

%C If p and q are twin primes and x is their average, then among all pairs of primes (k, m) such that |x - k| = |x - m|, it is observed that p and q are at the smallest distance from x, which is 1. Our interest lies in finding the pair (m, k) such that the distance to x is maximum and then determining |k - m|.

%e Since the 3rd pair of twin primes is (11, 13), whose sum is 24, and the other pairs of primes that sum to 24 are (5, 19) and (7, 17), the greatest difference is 19 - 5 = 14. Therefore, a(3) = 14.

%o (Python)

%o from itertools import islice

%o from sympy import isprime, nextprime, primerange

%o def agen(): # generator of terms

%o p, q = 2, 3

%o while True:

%o if q - p == 2:

%o s = p + q

%o yield max(m-k for k in primerange(2, s//2+1) if isprime(m:=s-k))

%o p, q = q, nextprime(q)

%o print(list(islice(agen(), 80))) # _Michael S. Branicky_, Aug 13 2024

%Y Cf. A001359, A020482, A014574.

%K nonn

%O 1,1

%A _Gonzalo Martínez_, Aug 13 2024