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.

A130621 List the first term of each triple of consecutive primes with the property that their sum is the square of a prime.

Original entry on oeis.org

13, 37, 277, 313, 613, 7591, 8209, 12157, 23053, 32233, 42953, 44887, 105649, 225769, 245941, 258707, 287671, 331333, 342049, 346111, 347443, 393853, 560719, 721267, 867253, 1001089, 1064431, 1219849, 1545127, 1556623, 1617727, 1752607
Offset: 1

Views

Author

J. M. Bergot, Jun 18 2007

Keywords

Examples

			(37, 41, 43) is a triple of consecutive prime numbers; their sum is 121 which is a prime squared. Hence 37 is in the sequence.
		

Programs

  • Maple
    f:= proc(n) local p,q,r;
       q:= prevprime(floor(n/3));
       p:= prevprime(q);
       r:= nextprime(q);
       if p+q+r = n then return p
       elif p+q+r < n then
         while p+q+r < n do
           p:= q; q:= r; r:= nextprime(r);
         od;
         if p+q+r = n then return p fi
       else
         while p+q+r > n do
           r:= q; q:= p; p:= prevprime(p);
         od;
         if p+q+r = n then return p fi;
       fi;
       false
    end proc:
    R:= NULL: count:= 0:
    p:= 3:
    while count < 100 do
      p:= nextprime(p);
      v:= f(p^2);
      if v::integer then
        R:= R,v; count:= count+1;
      fi
    od:
    R; # Robert Israel, Sep 18 2022
  • Mathematica
    a={};For[n=1,n<100000,n++,If[PrimeQ[Sqrt[Prime[n]+Prime[n+1]+Prime[n+2]]], AppendTo[a, Prime[n]]]]; a
    Select[Partition[Prime[Range[132000]],3,1],PrimeQ[Sqrt[Total[#]]]&][[All,1]] (* Harvey P. Dale, Dec 12 2022 *)

Extensions

Edited and extended by Stefan Steinerberger, Jun 23 2007