OFFSET
1,1
COMMENTS
a(n) is prime only when n is the greater of a twin prime pair (A006512). All other terms are composite.
EXAMPLE
9 is a term because the previous prime < 9 is 7, and 9 - 7 = 2, which is prime.
MATHEMATICA
Select[Range[2, 130], PrimeQ[# - NextPrime[#, -1]] &] (* Amiram Eldar, Jan 02 2022 *)
PROG
(Python)
from sympy import isprime, prevprime
def ok(n): return n > 2 and isprime(n-prevprime(n))
print([k for k in range(249) if ok(k)]) # Michael S. Branicky, Jan 01 2022
(PARI) isok(k) = if (k>2, my(q=precprime(k-1)); isprime(k-q)); \\ Michel Marcus, Jan 02 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Ryan Bresler, Jan 01 2022
STATUS
approved