cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-4 of 4 results.

A007510 Single (or isolated or non-twin) primes: Primes p such that neither p-2 nor p+2 is prime.

Original entry on oeis.org

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
Offset: 1

Views

Author

Keywords

Comments

Almost all primes are a member of this sequence by Brun's theorem.
A010051(a(n))*(1-A164292(a(n))) = 0; complement of A001097 with respect to A000040. - Reinhard Zumkeller, Mar 31 2010

Examples

			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
		

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).

Crossrefs

Programs

  • 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)
    -- Reinhard Zumkeller, Sep 16 2014
    
  • Magma
    [p: p in PrimesUpTo(1000)| not IsPrime(p-2) and not IsPrime(p+2)]; // Vincenzo Librandi, Jun 20 2014
    
  • 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 *)
  • 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
    
  • 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
    print(aupto(563)) # Michael S. Branicky, Feb 23 2021
  • 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
    

Formula

A010051(a(n)-2) + A010051(a(n)+2) = 0, n > 2. - Reinhard Zumkeller, Sep 16 2014
a(n) = prime(A176656(n)). - R. J. Mathar, Feb 19 2017
a(n) ~ n log n. - Charles R Greathouse IV, Aug 21 2017

Extensions

More terms from Pab Ter (pabrlos2(AT)yahoo.com), Nov 11 2005

A124582 Primes p such that q-p >= 6, where q is the next prime after p.

Original entry on oeis.org

23, 31, 47, 53, 61, 73, 83, 89, 113, 131, 139, 151, 157, 167, 173, 181, 199, 211, 233, 241, 251, 257, 263, 271, 283, 293, 317, 331, 337, 353, 359, 367, 373, 383, 389, 401, 409, 421, 433, 443, 449, 467, 479, 491, 503, 509, 523, 541, 547, 557, 563, 571, 577
Offset: 1

Views

Author

N. J. A. Sloane, Dec 19 2006

Keywords

Crossrefs

Complement of A124589.

Programs

  • Maple
    d:=6; M:=1000; t0:=[]; for n from 1 to M do p:=ithprime(n); if nextprime(p) - p >= d then t0:=[op(t0),p]; fi; od: t0;
  • Mathematica
    t={};q=6;Do[If[Prime[n+6]-Prime[n+5]>=q,AppendTo[t,Prime[n+5]]],{n,1,200}];t (* Vladimir Joseph Stephan Orlovsky, Feb 02 2012 *)
    Transpose[Select[Partition[Prime[Range[200]],2,1],#[[2]]-#[[1]] >= 6&]] [[1]] (* Harvey P. Dale, May 15 2013 *)
  • PARI
    is(n)=!isprime(n+2) && !isprime(n+4) && n>2 && isprime(n) \\ Charles R Greathouse IV, Jun 04 2015

Formula

a(n) ~ n log n. - Charles R Greathouse IV, Jun 04 2015

A134100 Primes p > 3 such that neither p-2 nor p-4 are prime.

Original entry on oeis.org

29, 37, 53, 59, 67, 79, 89, 97, 127, 137, 149, 157, 163, 173, 179, 191, 211, 223, 239, 251, 257, 263, 269, 277, 293, 307, 331, 337, 347, 359, 367, 373, 379, 389, 397, 409, 419, 431, 439, 449, 457, 479, 487, 499, 509, 521, 541, 547, 557, 563, 569, 577, 587
Offset: 1

Views

Author

Enoch Haga, Oct 08 2007

Keywords

Comments

Upper primes after a prime gap of 6 or larger (Union of A031925, A031927, A031929, ...) - R. J. Mathar, Mar 15 2012

Examples

			29 is a term because 29 follows the odd nonprime 27 which in turn follows the odd nonprime 25.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[5,1000,2],PrimeQ[#]&&!PrimeQ[#-2]&&!PrimeQ[#-4]&] (* Vladimir Joseph Stephan Orlovsky, Feb 03 2012 *)
  • PARI
    forprime(p=5,600,if(!isprime(p-2) && !isprime(p-4), print1(p,", "))); \\ Joerg Arndt, Oct 27 2021
    
  • PARI
    list(lim)=my(v=List(),p=23); forprime(q=29,lim, if(q-p>4, listput(v,q)); p=q); Vec(v) \\ Charles R Greathouse IV, Oct 27 2021

Formula

a(n) ~ n log n. - Charles R Greathouse IV, Oct 27 2021

Extensions

Name corrected by Michel Marcus and Amiram Eldar, Oct 27 2021

A134101 Odd nonprimes such that the prior odd number is not a prime but the next odd number is a prime.

Original entry on oeis.org

27, 35, 51, 57, 65, 77, 87, 95, 125, 135, 147, 155, 161, 171, 177, 189, 209, 221, 237, 249, 255, 261, 267, 275, 291, 305, 329, 335, 345, 357, 365, 371, 377, 387, 395, 407, 417, 429, 437, 447, 455, 477, 485, 497, 507, 519, 539, 545, 555, 561, 567, 575, 585
Offset: 1

Views

Author

Enoch Haga, Oct 08 2007

Keywords

Examples

			a(1)=27 because this odd nonprime is followed by the prime 29 but preceded by the odd nonprime 25.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[5,1000,2],!PrimeQ[#]&&!PrimeQ[#-2]&&PrimeQ[#+2]&] (* Vladimir Joseph Stephan Orlovsky, Feb 03 2012 *)
    Transpose[Select[Partition[Range[1,601,2],3,1],Boole[PrimeQ[#]]=={0,0,1}&]] [[2]] (* or *) 2#+1&/@Flatten[Position[Partition[Boole[PrimeQ[ Range[ 1,601,2]]],3,1],?(#=={0,0,1}&)]] (* _Harvey P. Dale, Jan 04 2015 *)
  • 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

Extensions

Definition clarified by Harvey P. Dale, Jan 04 2015
Showing 1-4 of 4 results.