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