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-3 of 3 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

A023186 Lonely (or isolated) primes: increasing distance to nearest prime.

Original entry on oeis.org

2, 5, 23, 53, 211, 1847, 2179, 3967, 16033, 24281, 38501, 58831, 203713, 206699, 413353, 1272749, 2198981, 5102953, 10938023, 12623189, 72546283, 142414669, 162821917, 163710121, 325737821, 1131241763, 1791752797, 3173306951, 4841337887, 6021542119, 6807940367, 7174208683, 8835528511, 11179888193, 15318488291, 26329105043, 31587561361, 45241670743
Offset: 1

Views

Author

Keywords

Comments

Erdős and Suranyi call these reclusive primes and prove that there are an infinite number of them. They define these primes to be between two primes. Hence their first term would be 3 instead of 2. Record values in A120937. - T. D. Noe, Jul 21 2006

Examples

			The nearest prime to 23 is 4 units away, larger than any previous prime, so 23 is in the sequence.
The prime a(4) = A120937(3) = 53 is at distance 2*3 = 6 from its neighbors {47, 59}. The prime a(5) = A120937(4) = A120937(5) = A120937(6) = 211 is at distance 2*6 = 12 from its neighbors {199, 223}. Sequence A120937 requires the terms to have 2 neighbors, therefore its first term is 3 and not 2. - _M. F. Hasler_, Dec 28 2015
		

References

  • Paul Erdős and Janos Suranyi, Topics in the theory of numbers, Springer, 2003.

Crossrefs

Programs

  • Mathematica
    p = 0; q = 2; i = 0; Do[r = NextPrime[q]; m = Min[r - q, q - p]; If[m > i, Print[q]; i = m]; p = q; q = r, {n, 1, 152382000}]
    Join[{2},DeleteDuplicates[{#[[2]],Min[Differences[#]]}&/@Partition[Prime[ Range[ 2,10^6]],3,1],GreaterEqual[ #1[[2]],#2[[2]]]&][[;;,1]]] (* The program generates the first 20 terms of the sequence. *) (* Harvey P. Dale, Aug 31 2023 *)

Extensions

More terms from Jud McCranie, Jun 16 2000
More terms from T. D. Noe, Jul 21 2006

A103709 Smallest prime p such that both p +/- 2n are primes closest to p, or zero if no such prime exists.

Original entry on oeis.org

5, 0, 53, 0, 0, 211, 0, 0, 20201, 0, 0, 16787, 0, 0, 69623, 0, 0, 255803, 0, 0, 247141, 0, 0, 3565979, 0, 0, 6314447, 0, 0, 4911311, 0, 0, 12012743, 0, 0, 23346809, 0, 0, 43607429, 0, 0, 34346287, 0, 0, 36598607, 0, 0, 51042053, 0, 0, 460475569, 0, 0
Offset: 1

Views

Author

Zak Seidov, Feb 12 2005

Keywords

Comments

Such triples of primes occur only for n divisible by 3 (except for the first term with n=1).

Examples

			a(36)=23346809 because 23346809-72, 23346809 and 23346809+72 are three successive primes and 23346809 is the least such prime.
		

Crossrefs

Formula

p-2n, p and p+2n are three successive primes and p is the least such prime.

Extensions

More terms from Robert G. Wilson v, Feb 22 2005
Definition, Formula, and Example clarified by Jonathan Sondow, Oct 27 2017
Showing 1-3 of 3 results.