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.

A356475 First of three consecutive primes p,q,r such that p*q + q*r + r*p is prime.

Original entry on oeis.org

2, 3, 5, 7, 17, 29, 37, 41, 43, 67, 83, 103, 137, 157, 179, 181, 193, 227, 277, 283, 347, 359, 383, 431, 457, 461, 607, 661, 701, 709, 757, 773, 823, 827, 839, 859, 937, 967, 1013, 1051, 1061, 1109, 1129, 1187, 1201, 1213, 1249, 1283, 1307, 1327, 1373, 1423, 1439, 1471, 1481, 1487, 1543, 1567
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Aug 08 2022

Keywords

Examples

			a(4) = 7 is a term because 7, 11, 13 are three consecutive primes with 7*11 + 11*13 + 13*7 = 311 which is prime.
		

Crossrefs

Programs

  • Maple
    R:= NULL: count:= 0:
    P:= Vector(3,ithprime):
    while count < 100 do
      x:= P[1]*P[2]+P[2]*P[3]+P[3]*P[1];
      if isprime(x) then R:= R, P[1]; count:= count+1 fi;
      P[1..2]:= P[2..3];
      P[3]:= nextprime(P[3]);
    od:
    R;
  • Mathematica
    Select[Partition[Prime[Range[250]], 3, 1], PrimeQ[Total[# * RotateLeft[#]]] &][[;; , 1]] (* Amiram Eldar, Aug 08 2022 *)
  • PARI
    list(lim)=my(v=List(),p=2,q=3); forprime(r=5,nextprime(nextprime(lim\1+1)+1), if(isprime(p*q + q*r + r*p), listput(v,p)); p=q; q=r); Vec(v) \\ Charles R Greathouse IV, Sep 06 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 + q*r + r*p): yield p
            p, q, r = q, r, nextprime(r)
    print(list(islice(agen(), 58))) # Michael S. Branicky, Aug 08 2022
    

A356477 a(n) is the start of the first sequence of 2*n+1 consecutive primes p_1, p_2, ..., p_(2*n+1) such that p_1*p_2 + p_2*p_3 + ... + p_(2*n)*p_(2*n+1) + p_(2*n+1)*p_1 is prime.

Original entry on oeis.org

2, 19, 19, 2, 23, 2, 7, 7, 2, 5, 113, 5, 29, 13, 67, 53, 11, 11, 5, 23, 7, 43, 5, 2, 31, 73, 13, 3, 89, 5, 11, 3, 89, 31, 43, 2, 37, 2, 23, 7, 11, 19, 43, 23, 5, 2, 23, 3, 29, 5, 17, 3, 31, 29, 53, 29, 7, 13, 73, 3, 5, 43, 29, 17, 5, 37, 19, 11, 71, 7, 2, 43, 13, 19, 2, 59, 7, 29, 113, 13, 5, 11
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Aug 08 2022

Keywords

Examples

			a(2) = 19 because 19 is the start of the 2*2+1 = 5 consecutive primes 19, 23, 29, 31, 37 with 19*23 + 23*29 + 29*31 + 31*37 + 37*19 = 3853 prime, and no earlier 5-tuple of consecutive primes works.
		

Crossrefs

Programs

  • Maple
    f:= proc(m) local P,x,i,n;
      n:= 2*m+1;
      P:= Vector(n,ithprime);
    do
       x:= add(P[i]*P[i+1],i=1..n-1)+P[n]*P[1];
       if isprime(x) then return P[1] fi;
       P[1..n-1]:= P[2..n];
       P[n]:= nextprime(P[n]);
    od
    end proc:
    map(f, [$1..100]);
  • Python
    from sympy import isprime, nextprime, prime, primerange
    def a(n):
        p = list(primerange(1, prime(2*n+1)+1))
        while True:
            if isprime(sum(p[i]*p[i+1] for i in range(len(p)-1))+p[-1]*p[0]):
                return p[0]
            p = p[1:] + [nextprime(p[-1])]
    print([a(n) for n in range(1, 83)]) # Michael S. Branicky, Aug 08 2022
Showing 1-2 of 2 results.