login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Hermit primes: primes which are not a nearest neighbor of another prime.
3

%I #35 Jan 06 2020 18:12:42

%S 23,37,53,67,89,97,113,157,173,211,233,277,293,307,317,359,389,409,

%T 449,457,467,479,509,577,607,631,653,691,719,751,839,853,863,877,887,

%U 919,929,1039,1069,1087,1201,1223,1237,1283,1297,1307,1327,1381,1423,1439

%N Hermit primes: primes which are not a nearest neighbor of another prime.

%C If p is a balanced prime (A006562), with two nearest neighbors, then it eliminates both of those neighbors from being hermits.

%C Conjecture: the asymptotic probability of a prime being in this list is 1/4.

%C 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

%H Karl W. Heuer, <a href="/A268343/b268343.txt">Table of n, a(n) for n = 1..30000</a>

%H Robert Israel, <a href="/A268343/a268343.txt">Table of n, a(n) for n = 1..2600035</a>

%e 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.

%p N:= 1000: # to get all terms <= N

%p pr:= select(isprime, [$2 .. nextprime(nextprime(N))]):

%p Np:= nops(pr):

%p ishermit:= Vector(Np,1):

%p d:= pr[3..Np] + pr[1..Np-2] - 2*pr[2..Np-1]:

%p for i from 1 to Np-2 do

%p if d[i] > 0 then ishermit[i]:= 0

%p elif d[i] < 0 then ishermit[i+2]:= 0

%p else ishermit[i]:= 0; ishermit[i+2]:= 0

%p fi

%p od:

%p subs(0=NULL, zip(`*`, pr[1..Np-2],convert(ishermit,list))); # _Robert Israel_, Mar 09 2016

%t 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 *)

%o (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

%o (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

%Y Cf. A269734 (number of hermit primes <= prime(n)).

%K easy,nonn

%O 1,1

%A _Karl W. Heuer_, Feb 02 2016

%E Deleted my incorrect conjecture about asymptotic behavior. - _N. J. A. Sloane_, Mar 10 2016