OFFSET
1,1
COMMENTS
If p is a balanced prime (A006562), with two nearest neighbors, then it eliminates both of those neighbors from being hermits.
Conjecture: the asymptotic probability of a prime being in this list is 1/4.
A subsequence of the isolated primes A007510. The sequence of lonely primes A087770 appears to be a subsequence, except for its first three terms (2, 3 and 7). (This would not be true if one of these were followed by two increasingly larger gaps.) - M. F. Hasler, Mar 15 2016
LINKS
Karl W. Heuer, Table of n, a(n) for n = 1..30000
Robert Israel, Table of n, a(n) for n = 1..2600035
EXAMPLE
53 is in the list because the previous prime, 47, is closer to 43 than to 53, and the following prime, 59, is closer to 61 than to 53.
MAPLE
N:= 1000: # to get all terms <= N
pr:= select(isprime, [$2 .. nextprime(nextprime(N))]):
Np:= nops(pr):
ishermit:= Vector(Np, 1):
d:= pr[3..Np] + pr[1..Np-2] - 2*pr[2..Np-1]:
for i from 1 to Np-2 do
if d[i] > 0 then ishermit[i]:= 0
elif d[i] < 0 then ishermit[i+2]:= 0
else ishermit[i]:= 0; ishermit[i+2]:= 0
fi
od:
subs(0=NULL, zip(`*`, pr[1..Np-2], convert(ishermit, list))); # Robert Israel, Mar 09 2016
MATHEMATICA
Select[Prime@ Range@ 228, Function[n, AllTrue[{Subtract @@ Take[#, 2], Subtract @@ Reverse@ Take[#, -2]} &@ Differences[NextPrime[n, #] & /@ {-2, -1, 0, 1, 2}], # < 0 &]]] (* Michael De Vlieger, Feb 02 2016, Version 10 *)
PROG
(PARI) A268343_list(LIM=1500)={my(d=vector(4), i, o, L=List()); forprime(p=1, LIM, (d[i++%4+1]=-o+o=p)<d[(i-1)%4+1]&&d[(i-2)%4+1]>d[(i-3)%4+1]&&listput(L, p-d[i%4+1]-d[(i-1)%4+1])); Vec(L)} \\ M. F. Hasler, Mar 15 2016
(PARI) is_A268343(n, p=precprime(n-1))={n-p>p-precprime(p-1)&&(p=nextprime(n+1))-n>nextprime(p+1)-p&&isprime(n)} \\ M. F. Hasler, Mar 15 2016
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Karl W. Heuer, Feb 02 2016
EXTENSIONS
Deleted my incorrect conjecture about asymptotic behavior. - N. J. A. Sloane, Mar 10 2016
STATUS
approved