cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A375358 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.

Original entry on oeis.org

2, 2, 14, 26, 46, 74, 106, 134, 194, 206, 266, 286, 346, 374, 382, 442, 454, 506, 550, 614, 686, 818, 854, 914, 1034, 1118, 1186, 1226, 1274, 1294, 1606, 1630, 1618, 1702, 1754, 2018, 2042, 2078, 2102, 2174, 2290, 2434, 2546, 2534, 2582, 2626, 2846, 2890, 2950
Offset: 1

Views

Author

Gonzalo Martínez, Aug 13 2024

Keywords

Comments

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|.

Examples

			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.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from sympy import isprime, nextprime, primerange
    def agen(): # generator of terms
        p, q = 2, 3
        while True:
            if q - p == 2:
                s = p + q
                yield max(m-k for k in primerange(2, s//2+1) if isprime(m:=s-k))
            p, q = q, nextprime(q)
    print(list(islice(agen(), 80))) # Michael S. Branicky, Aug 13 2024