login
A350460
Positive integers k such that if p is the next prime > k then p - k is prime.
1
3, 5, 8, 9, 11, 14, 15, 17, 20, 21, 24, 26, 27, 29, 32, 34, 35, 38, 39, 41, 44, 45, 48, 50, 51, 54, 56, 57, 59, 62, 64, 65, 68, 69, 71, 74, 76, 77, 80, 81, 84, 86, 87, 90, 92, 94, 95, 98, 99, 101, 104, 105, 107, 110, 111, 114, 116, 120, 122, 124, 125, 128, 129
OFFSET
1,1
COMMENTS
a(n) is only prime when n is the lesser of a twin prime pair (A001359). All other terms are composite.
EXAMPLE
3 is a term because the next prime > 3 is 5, and 5 - 3 = 2, which is prime.
14 is a term because the next prime > 14 is 17, and 17 - 14 = 3, which is prime.
MATHEMATICA
Select[Range[130], PrimeQ[NextPrime[#] - #] &] (* Amiram Eldar, Jan 01 2022 *)
PROG
(Python)
from sympy import isprime, nextprime
def ok(n): return n > 0 and isprime(nextprime(n) - n)
print([k for k in range(130) if ok(k)]) # Michael S. Branicky, Jan 01 2022
(PARI) isok(k) = my(p=nextprime(k+1)); isprime(p-k); \\ Michel Marcus, Jan 01 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Ryan Bresler, Jan 01 2022
STATUS
approved