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.

A130761 Primes prime(n) such that at least one of the two numbers (prime(n+2)^2-prime(n)^2)/2 - 1 and (prime(n+2)^2-prime(n)^2)/2 + 1 is prime.

Original entry on oeis.org

3, 5, 7, 11, 13, 19, 29, 31, 37, 41, 43, 53, 59, 61, 67, 71, 79, 83, 97, 107, 127, 139, 149, 157, 179, 181, 191, 197, 227, 229, 239, 251, 263, 283, 293, 307, 347, 349, 353, 373, 419, 439, 443, 463, 467, 479, 499, 523, 541, 569, 601, 607, 613, 617, 619
Offset: 1

Views

Author

J. M. Bergot, Jul 13 2007

Keywords

Examples

			(7^2 - 3^2)/2 - 1 is 19. Therefore 3 is in the sequence.
(19^2 - 13^2)/2 + 1 is 97. Hence 13 is in the sequence.
		

Programs

  • Maple
    Res:= NULL:
    p:= 5: q:= 3:
    count:= 0:
    while count < 100 do
      r:= q; q:= p; p:= nextprime(p);
      v:= (p^2-r^2)/2;
      if isprime(v+1) or isprime(v-1) then
        count:= count+1; Res:= Res, r;
      fi
    od:
    Res; # Robert Israel, Oct 03 2018
  • Mathematica
    Prime[Select[Range[140], PrimeQ[(Prime[ #+2]^2-Prime[ # ]^2)/2+1] || PrimeQ[(Prime[ # +2]^2-Prime[ # ]^2)/2-1] &]]
    Select[Partition[Prime[Range[200]],3,1],AnyTrue[(#[[3]]^2-#[[1]]^2)/2+{1,-1},PrimeQ]&][[All,1]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Jun 28 2020 *)

Extensions

Edited and extended by Stefan Steinerberger, Jul 23 2007