OFFSET
1,1
LINKS
EXAMPLE
3 is not a term because two of the four neighbors (1, 5, 17 and 21) are primes.
97 is a term because 97 is a prime and all four neighbors (51, 95, 99 and 159) are composites (see the illustration in Links).
PROG
(Python)
from sympy import prime, isprime; from math import sqrt, ceil
def neib(m):
n = int(ceil((sqrt(m)+1.0)/2.0)); L = [m, m, m, m]
z1=4*n*n-12*n+10; z2=4*n*n-10*n+7; z3=4*n*n-8*n+5; z4=4*n*n-6*n+3; z5=4*n*n-4*n+1
L[0]+=1 if m<z2 else 8*n-5 if m<=z3 else -1 if m<=z4 else -8*n+9
L[1]+=-1 if m==z1 else -8*n+15 if m<z2 else 1 if m<z3 else 8*n-3 if m<=z4 else -1
L[2]+=8*n-9 if m==z1 else -1 if m<=z2 else -8*n+13 if m<z3 else i if m<z4 else 8*n-1
L[3]+=8*n-7 if m<=z2 else -1 if m<=z3 else -8*n+11 if m<z4 else 1
return L
for i in range(2, 200):
p = prime(i); L1 = [2*neib(int((p+1)/2))[j]-1 for j in range(4)]
if sum(isprime(k) for k in L1) == 0: print(p)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ya-Ping Lu, May 20 2021
STATUS
approved