|
|
A007510
|
|
Single (or isolated or non-twin) primes: Primes p such that neither p-2 nor p+2 is prime.
(Formerly M2130)
|
|
96
|
|
|
2, 23, 37, 47, 53, 67, 79, 83, 89, 97, 113, 127, 131, 157, 163, 167, 173, 211, 223, 233, 251, 257, 263, 277, 293, 307, 317, 331, 337, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 439, 443, 449, 457, 467, 479, 487, 491, 499, 503, 509, 541, 547, 557, 563
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
COMMENTS
|
Almost all primes are a member of this sequence by Brun's theorem.
|
|
REFERENCES
|
Richard L. Francis, "Isolated Primes", J. Rec. Math., 11 (1978), 17-22.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
Jens Kruse Andersen, Paul Underwood and Pierre Cami, Chen prime with 70301 digits, digest of 3 messages in primeform Yahoo group, Oct 7, 2005.
|
|
FORMULA
|
|
|
EXAMPLE
|
All primes congruent to 7 mod 15 are members, except for 7. All terms of A102723 are members, except for 5. - Jonathan Sondow, Oct 27 2017
|
|
MAPLE
|
with(numtheory): for i from 1 to 150 do p:=ithprime(i): if(not isprime(p+2) and not isprime(p-2)) then printf("%d, ", p) fi od: # Pab Ter
isA007510 := proc(n) isprime(n) and not isprime(n+2) and not isprime(n-2) ; simplify(%) ; end proc:
A007510 := proc(n) if n = 1 then 2; else for a from procname(n-1)+1 do if isA007510(a) then return a; end if; end do; end if; end proc: # R. J. Mathar, Apr 26 2010
|
|
MATHEMATICA
|
Transpose[Select[Partition[Prime[Range[100]], 3, 1], #[[2]] - #[[1]] != 2 && #[[3]] - #[[2]] != 2 &]][[2]] (* Harvey P. Dale, Mar 01 2001 *)
Select[Prime[Range[4, 100]], !PrimeQ[ #-2]&&!PrimeQ[ #+2]&] (* Zak Seidov, May 07 2007 *)
Select[Prime[Range[150]], NoneTrue[#+{2, -2}, PrimeQ]&] (* Harvey P. Dale, Dec 26 2022 *)
|
|
PROG
|
(UBASIC) 10 'primes using counters 20 N=3:print "2 "; :print "3 "; :C=2 30 A=3:S=sqrt(N) 40 B=N\A 50 if B*A=N then 55 55 Q=N+2:R=N-2: if Q<>prmdiv(Q) and N=prmdiv(N) and R<>prmdiv(R) then print Q; N; R; "-"; :stop:else N=N+2:goto 30 60 A=A+2 70 if A<=sqrt(N) then 40:stop 81 C=C+1 100 N=N+2:goto 30 ' Enoch Haga, Oct 08 2007
(PARI) forprime(x=2, 1000, if(!isprime(x-2)&&!isprime(x+2), print(x))) \\ Zak Seidov, Mar 23 2009
(PARI) list(lim)=my(v=List([2]), p=3, q=5); forprime(r=7, lim, if(q-p>2 && r-q>2, listput(v, q)); p=q; q=r); p=precprime(lim); if(p<=lim && p-precprime(p-2)>2 && nextprime(p+2)-p>2, listput(v, p)); Vec(v) \\ Charles R Greathouse IV, Aug 21 2017
(Magma) [p: p in PrimesUpTo(1000)| not IsPrime(p-2) and not IsPrime(p+2)]; // Vincenzo Librandi, Jun 20 2014
(Haskell)
import Data.List (elemIndices)
a007510 n = a007510_list !! (n-1)
a007510_list = map (+ 1) $ elemIndices (0, 1, 0) $
zip3 (drop 2 a010051_list) a010051_list (0 : 0 : a010051_list)
(Python)
from sympy import nextprime
def aupto(limit):
n, p, q = 1, 2, 3
alst, non_twins, twins = [], [2], [3]
while True:
p, q = q, nextprime(q)
if q - p == 2:
if p != twins[-1]: twins.append(p)
twins.append(q)
else:
if p != twins[-1]: non_twins.append(p)
if q > limit: return non_twins
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
More terms from Pab Ter (pabrlos2(AT)yahoo.com), Nov 11 2005
|
|
STATUS
|
approved
|
|
|
|