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

A083370 Primes satisfying f(2p)=p when f(1)=5 (see comment).

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

Views

Author

Benoit Cloitre, Jun 04 2003

Keywords

Comments

Conjecture: start from any initial value f(1) >= 2 and define f(n) to be the largest prime factor of f(1)+f(2)+...+f(n-1); then f(n) = n/2 + O(log(n)) and there are infinitely many primes p such that f(2p)=p.
Coincides with A124582 in the first 154 terms: a(154) = A124582(154) = 1723, but a(155,156,...) = 1777, 1783, 1801, 2017, 3251, ..., whereas A124582(155,156,...) = 1733, 1741, 1747, ... - R. J. Mathar, Feb 08 2007

Crossrefs

Cf. A076973.

Programs

  • Maple
    A006530 := proc(n) if n = 1 then RETURN(1) ; else RETURN(op(1,op(-1,op(2,ifactors(n))))) ; fi ; end: f := proc(n) option remember ; if n = 1 then RETURN(5) ; else A006530(add(f(i),i=1..n-1)) ; fi ; end: isA083370 := proc(p) if isprime(p) then if p = f(2*p) then true ; else false ; fi ; else false ; fi ; end: n := 1 : i := 1 : while n <= 1000 do p := ithprime(i) ; if isA083370(p) then printf("%d %d ",n,p) ; n := n+ 1 ; fi ; i := i+1 ; end: # R. J. Mathar, Feb 08 2007
  • Mathematica
    f[n_] := f[n] = If[n==1, 5, FactorInteger[Total[f /@ Range[n-1]]][[-1, 1]]];
    Reap[For[p=2, p<500, p = NextPrime[p], If[f[2p] == p, Sow[p]]]][[2, 1]] (* Jean-François Alcover, Oct 31 2019 *)

A124589 Primes p such that q-p <= 4, where q is the next prime after p.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 29, 37, 41, 43, 59, 67, 71, 79, 97, 101, 103, 107, 109, 127, 137, 149, 163, 179, 191, 193, 197, 223, 227, 229, 239, 269, 277, 281, 307, 311, 313, 347, 349, 379, 397, 419, 431, 439, 457, 461, 463, 487, 499, 521, 569, 599, 613, 617, 641, 643, 659
Offset: 1

Views

Author

N. J. A. Sloane, Dec 19 2006

Keywords

Comments

Union of A124588 and A029710; complement of A124582. - Reinhard Zumkeller, Dec 23 2006

Crossrefs

Programs

  • Mathematica
    Transpose[Select[Partition[Prime[Range[200]],2,1],Last[#]-First[#]<5&]][[1]] (* Harvey P. Dale, Apr 22 2013 *)
  • PARI
    is(n)=isprime(n) && (isprime(n+2) || isprime(n+4) || n==2) \\ Charles R Greathouse IV, Jun 01 2016

Formula

a(n) >> n log^2 n. Infinite under standard conjectures. - Charles R Greathouse IV, Jun 01 2016

A134099 Odd nonprimes np such that np-2 is a prime number but np+2 is not.

Original entry on oeis.org

25, 33, 49, 55, 63, 75, 85, 91, 115, 133, 141, 153, 159, 169, 175, 183, 201, 213, 235, 243, 253, 259, 265, 273, 285, 295, 319, 333, 339, 355, 361, 369, 375, 385, 391, 403, 411, 423, 435, 445, 451, 469, 481, 493, 505, 511, 525, 543, 549, 559, 565, 573, 579
Offset: 1

Views

Author

Enoch Haga, Oct 08 2007

Keywords

Comments

Primes referred to in the example are found in A124582 (see A083370 and compare A124582).

Examples

			a(1) = 25 because it is an odd nonprime preceded by the prime 23 and followed by the odd nonprime 27.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[5,1000,2], !PrimeQ[#] && PrimeQ[#-2] && !PrimeQ[#+2]&] (* Vladimir Joseph Stephan Orlovsky, Feb 03 2012 *)
    2#-1&/@(Mean/@SequencePosition[Table[If[PrimeQ[n],1,0],{n,1,601,2}],{1,0,0}]) (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jul 31 2020 *)
    Select[Partition[Range[600],5,2],PrimeQ[#[[1]]]&&AllTrue[{#[[3]],#[[5]]},CompositeQ]&][[;;,3]] (* Harvey P. Dale, May 14 2023 *)
  • 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 corrected by Jens Voß, Mar 12 2014
Definition modified by Harvey P. Dale, May 14 2023

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

A258578 Primes p such that difference between p and next prime after p is multiple of 6.

Original entry on oeis.org

23, 31, 47, 53, 61, 73, 83, 131, 151, 157, 167, 173, 199, 211, 233, 251, 257, 263, 271, 331, 353, 367, 373, 383, 433, 443, 467, 503, 509, 523, 541, 557, 563, 571, 587, 593, 601, 607, 619, 647, 653, 661, 677, 727, 733, 751, 797, 941, 947, 971, 977, 991, 997
Offset: 1

Views

Author

Zak Seidov, Jun 04 2015

Keywords

Comments

A031924 is subsequence: first 12 terms are the same.

Examples

			a(1)=23 because next prime after 23 is 29=23+6,
a(13)=199 because next prime after 199 is 211=199+12,
a(30)=523 because next prime after 523 is 541=523+18,
a(90)=1669 because next term after 1669 is 1693=1669+24,
a(199)=4297 because next prime after 4297 is 4327=4297+30.
		

Crossrefs

Programs

  • Mathematica
    Select[Partition[Prime[Range[200]],2,1],Mod[#[[2]]-#[[1]],6]==0&][[All,1]] (* Harvey P. Dale, Jun 20 2019 *)
  • PARI
    lista(nn) = forprime(p=2, nn, if (!((nextprime(p+1) - p) % 6), print1(p, ", "));); \\ Michel Marcus, Jun 04 2015
    
  • PARI
    v=List();p=2; forprime(q=3,1e4,if((q-p)%6==0,listput(v,p));p=q); v \\ Charles R Greathouse IV, Jun 04 2015

A382766 Odd primes p such that p + 4, p + 6 and p + 8 are composite.

Original entry on oeis.org

113, 137, 139, 179, 181, 197, 199, 211, 239, 241, 281, 283, 293, 317, 337, 409, 419, 421, 467, 509, 521, 523, 547, 577, 617, 619, 631, 659, 661, 691, 709, 773, 787, 797, 809, 811, 827, 829, 839, 863, 887, 919, 953, 997, 1019, 1021, 1039, 1049, 1051, 1069
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Maple
    P:= select(isprime,{seq(i,i=3..10008,2)}):
    R:= P minus (P -~ 4) minus (P -~ 6) minus (P -~ 8):
    sort(convert(R,list)); # Robert Israel, Apr 28 2025
  • Mathematica
    Select[Table[
      Module[{p = 2, q},
       While[True, q = 2 n - p; If[PrimeQ[p] && PrimeQ[q], Break[]];
        p = NextPrime[p]]; If[p == 11, q, Nothing]], {n, 2, 1000}], # =!=
       Nothing &]
  • PARI
    isok(p) = (p%2) && isprime(p) && !isprime(p+4) && !isprime(p+6) && !isprime(p+8); \\ Michel Marcus, Apr 07 2025

A297709 Table read by antidiagonals: Let b be the number of digits in the binary expansion of n. Then T(n,k) is the k-th odd prime p such that the binary digits of n match the primality of the b consecutive odd numbers beginning with p (or 0 if no such k-th prime exists).

Original entry on oeis.org

3, 5, 7, 7, 13, 3, 11, 19, 5, 23, 13, 23, 11, 31, 7, 17, 31, 17, 47, 13, 5, 19, 37, 29, 53, 19, 11, 3, 23, 43, 41, 61, 37, 17, 0, 89, 29, 47, 59, 73, 43, 29, 0, 113, 23, 31, 53, 71, 83, 67, 41, 0, 139, 31, 19, 37, 61, 101, 89, 79, 59, 0, 181, 47, 43, 7, 41, 67
Offset: 1

Views

Author

Jon E. Schoenfield, Apr 15 2018

Keywords

Comments

For each n >= 1, row n is the union of rows 2n and 2n+1.
Rows with no nonzero terms: 15, 21, 23, 28, 30, 31, ...
Rows whose only nonzero term is 3: 7, 14, 29, 59, 118, 237, 475, 950, 1901, 3802, 7604, ...
Rows whose only nonzero term is 5: 219, 438, 877, 1754, 3508, 7017, 14035, ...
For j = 2, 3, 4, ..., respectively, the first row whose only nonzero term is prime(j) is 7, 219, 2921, ...; is there such a row for every odd prime?

Examples

			13 = 1101_2, so row n=13 lists the odd primes p such that the four consecutive odd numbers p, p+2, p+4, and p+6 are prime, prime, composite, and prime, respectively; these are the terms of A022004.
14 = 1110_2, so row n=14 lists the odd primes p such that p, p+2, p+4, and p+6 are prime, prime, prime, and composite, respectively; since there is only one such prime (namely, 3), there is no such 2nd, 3rd, 4th, etc. prime, so the terms in row 14 are {3, 0, 0, 0, ...}.
15 = 1111_2, so row n=15 would list the odd primes p such that p, p+2, p+4, and p+6 are all prime, but since no such prime exists, every term in row 15 is 0.
Table begins:
  n in base|                    k                   |  OEIS
  ---------+----------------------------------------+sequence
  10     2 |   1    2    3    4    5    6    7    8 | number
  =========+========================================+========
   1     1 |   3    5    7   11   13   17   19   23 | A065091
   2    10 |   7   13   19   23   31   37   43   47 | A049591
   3    11 |   3    5   11   17   29   41   59   71 | A001359
   4   100 |  23   31   47   53   61   73   83   89 | A124582
   5   101 |   7   13   19   37   43   67   79   97 | A029710
   6   110 |   5   11   17   29   41   59   71  101 | A001359*
   7   111 |   3    0    0    0    0    0    0    0 |
   8  1000 |  89  113  139  181  199  211  241  283 | A083371
   9  1001 |  23   31   47   53   61   73   83  131 | A031924
  10  1010 |  19   43   79  109  127  163  229  313 |
  11  1011 |   7   13   37   67   97  103  193  223 | A022005
  12  1100 |  29   59   71  137  149  179  197  239 | A210360*
  13  1101 |   5   11   17   41  101  107  191  227 | A022004
  14  1110 |   3    0    0    0    0    0    0    0 |
  15  1111 |   0    0    0    0    0    0    0    0 |
  16 10000 | 113  139  181  199  211  241  283  293 | A124584
  17 10001 |  89  359  389  401  449  479  491  683 | A031926
  18 10010 |  31   47   61   73   83  151  157  167 |
  19 10011 |  23   53  131  173  233  263  563  593 | A049438
  20 10100 |  19   43   79  109  127  163  229  313 |
  21 10101 |   0    0    0    0    0    0    0    0 |
  22 10110 |   7   13   37   67   97  103  193  223 | A022005
  23 10111 |   0    0    0    0    0    0    0    0 |
  24 11000 | 137  179  197  239  281  419  521  617 |
  25 11001 |  29   59   71  149  269  431  569  599 | A049437*
  26 11010 |  17   41  107  227  311  347  461  641 |
  27 11011 |   5   11  101  191  821 1481 1871 2081 | A007530
  28 11100 |   0    0    0    0    0    0    0    0 |
  29 11101 |   3    0    0    0    0    0    0    0 |
  30 11110 |   0    0    0    0    0    0    0    0 |
  31 11111 |   0    0    0    0    0    0    0    0 |
*other than the referenced sequence's initial term 3
.
Alternative version of table:
.
  n in base|primal-|               k              |  OEIS
  ---------+  ity  +------------------------------+  seq.
  10     2 |pattern|   1    2    3    4    5    6 | number
  =========+=======+==============================+========
   1     1 | p     |   3    5    7   11   13   17 | A065091
   2    10 | pc    |   7   13   19   23   31   37 | A049591
   3    11 | pp    |   3    5   11   17   29   41 | A001359
   4   100 | pcc   |  23   31   47   53   61   73 | A124582
   5   101 | pcp   |   7   13   19   37   43   67 | A029710
   6   110 | ppc   |   5   11   17   29   41   59 | A001359*
   7   111 | ppp   |   3    0    0    0    0    0 |
   8  1000 | pccc  |  89  113  139  181  199  211 | A083371
   9  1001 | pccp  |  23   31   47   53   61   73 | A031924
  10  1010 | pcpc  |  19   43   79  109  127  163 |
  11  1011 | pcpp  |   7   13   37   67   97  103 | A022005
  12  1100 | ppcc  |  29   59   71  137  149  179 | A210360*
  13  1101 | ppcp  |   5   11   17   41  101  107 | A022004
  14  1110 | pppc  |   3    0    0    0    0    0 |
  15  1111 | pppp  |   0    0    0    0    0    0 |
  16 10000 | pcccc | 113  139  181  199  211  241 | A124584
  17 10001 | pcccp |  89  359  389  401  449  479 | A031926
  18 10010 | pccpc |  31   47   61   73   83  151 |
  19 10011 | pccpp |  23   53  131  173  233  263 | A049438
  20 10100 | pcpcc |  19   43   79  109  127  163 |
  21 10101 | pcpcp |   0    0    0    0    0    0 |
  22 10110 | pcppc |   7   13   37   67   97  103 | A022005
  23 10111 | pcppp |   0    0    0    0    0    0 |
  24 11000 | ppccc | 137  179  197  239  281  419 |
  25 11001 | ppccp |  29   59   71  149  269  431 | A049437*
  26 11010 | ppcpc |  17   41  107  227  311  347 |
  27 11011 | ppcpp |   5   11  101  191  821 1481 | A007530
  28 11100 | pppcc |   0    0    0    0    0    0 |
  29 11101 | pppcp |   3    0    0    0    0    0 |
  30 11110 | ppppc |   0    0    0    0    0    0 |
  31 11111 | ppppp |   0    0    0    0    0    0 |
.
     *other than the referenced sequence's initial term 3
		

Crossrefs

Showing 1-9 of 9 results.