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-2 of 2 results.

A358743 First of three consecutive primes p,q,r such that p+q-r is prime.

Original entry on oeis.org

7, 11, 13, 17, 19, 29, 41, 43, 47, 59, 79, 101, 103, 107, 113, 137, 139, 163, 181, 193, 227, 229, 239, 257, 269, 281, 283, 311, 317, 359, 379, 397, 419, 421, 439, 461, 487, 491, 503, 521, 547, 569, 577, 599, 647, 659, 683, 691, 701, 709, 761, 811, 823, 857, 863, 881, 883, 887, 919, 983, 1019
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Nov 29 2022

Keywords

Comments

p+q-r is near (and less than) p and odd (for p > 2), so heuristically we would expect it to be prime about 2/log p of the time, yielding around 2x/log^2 x terms up to x. (A more careful analysis of small primes could yield a slightly different leading constant.) - Charles R Greathouse IV, Nov 29 2022

Examples

			a(3) = 13 is a prime because 13, 17, 19 are three consecutive primes with 13 + 17 - 19 = 11 prime.
		

Crossrefs

A136720 is a subsequence.

Programs

  • Maple
    R:= NULL: count:= 0: q:= 2: r:= 3:
    while count < 100 do
      p:= q; q:= r; r:=nextprime(r);
      if isprime(p+q-r) then count:= count+1; R1:= R1,p fi;
    od:
    R;
  • Mathematica
    Select[Partition[Prime[Range[180]], 3, 1], PrimeQ[#[[1]] + #[[2]] - #[[3]]] &][[;; , 1]] (* Amiram Eldar, Nov 29 2022 *)
  • PARI
    list(lim)=my(v=List(),p=7,q=11); forprime(r=13,nextprime(nextprime(lim\1+1)+1), if(isprime(p+q-r), listput(v,p)); p=q; q=r); Vec(v) \\ Charles R Greathouse IV, Nov 29 2022
  • Python
    from itertools import islice
    from sympy import isprime, nextprime
    def agen():
        p, q, r = 2, 3, 5
        while True:
            if isprime(p+q-r): yield p
            p, q, r = q, r, nextprime(r)
    print(list(islice(agen(), 61))) # Michael S. Branicky, Nov 29 2022
    

A136721 Prime quadruples: 3rd term.

Original entry on oeis.org

11, 17, 107, 197, 827, 1487, 1877, 2087, 3257, 3467, 5657, 9437, 13007, 15647, 15737, 16067, 18047, 18917, 19427, 21017, 22277, 25307, 31727, 34847, 43787, 51347, 55337, 62987, 67217, 69497, 72227, 77267, 79697, 81047, 82727, 88817, 97847
Offset: 1

Views

Author

Enoch Haga, Jan 18 2008

Keywords

Comments

Primes p such that p-6, p-4, and p+2 are prime. Apart from the first term, a(n) = 17 (mod 30).
The members of each quadruple are twin primes when they are 1st and 2nd terms and when 3rd and 4th terms. When they are 2nd and 3rd terms they differ by 4.

Examples

			The four terms in the first quadruple are 5,7,11,13 and in the 2nd 11,13,17,19. The four terms or members of each set must be simultaneously prime.
		

Crossrefs

Programs

  • Maple
    p2:= 0: p3:= 0: p4:= 0:
    Res:= NULL: count:= 0:
    while count < 100 do
      p1:= p2; p2:= p3; p3:= p4;
      p4:= nextprime(p4);
      if [p2-p1, p3-p2, p4-p3] = [2, 4, 2] then
         count:= count+1; Res:= Res, p3
      fi
    od:
    Res; # Robert Israel, Oct 11 2019
  • Mathematica
    lst={};Do[p0=Prime[n];If[PrimeQ[p2=p0+2], If[PrimeQ[p6=p0+6], If[PrimeQ[p8=p0+8], AppendTo[lst, p6]]]], {n, 12^4}];lst (* Vladimir Joseph Stephan Orlovsky, Aug 22 2008 *)

Formula

a(n) = A007530(n)+6 = A136720(n)+4 = A090258(n)-2. - Robert Israel, Oct 11 2019

Extensions

Edited by Charles R Greathouse IV, Oct 11 2009
Showing 1-2 of 2 results.