OFFSET
1,1
COMMENTS
LINKS
Lei Zhou, Table of n, a(n) for n = 1..10000
EXAMPLE
For 2, 2+-6 and 2+-12 are all even composite numbers. So 2 is excluded.
For 3, 3+-6 and 3+-12 are all multiples of 3. So 3 is excluded.
For each prime number p between 5 and 521, at least one number among p+-6 and p+-12 is a prime number, thus p is included.
For 523, 523 - 12 = 511 = 7*73, 523 - 6 = 517 = 11*47, 523 + 6 = 529 = 23^2, 523 + 12 = 535 = 5*107. They are all composites, so 523 is excluded.
MATHEMATICA
p = 1; Table[While[p = NextPrime[p]; ok = 0; a1 = p - 12; a2 = p - 6; a3 = p + 6; a4 = p + 12; If[a1 > 0, If[PrimeQ[a1], ok = 1]]; If[a2 > 0, If[PrimeQ[a2], ok = 1]]; If[PrimeQ[a3], ok = 1]; If[PrimeQ[a4], ok = 1]; ok == 0]; p, {n, 100}]
Select[Prime[Range[3, 150]], AnyTrue[#+{-12, -6, 6, 12}, PrimeQ]&] (* Harvey P. Dale, Feb 21 2022 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Lei Zhou, Apr 10 2014
STATUS
approved
