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.

A178659 Numbers n such that n^2 +- (n-1)^2 are primes.

Original entry on oeis.org

2, 3, 6, 10, 15, 30, 31, 36, 40, 51, 66, 70, 91, 100, 136, 175, 190, 205, 225, 231, 261, 285, 286, 316, 321, 331, 370, 376, 411, 441, 465, 496, 516, 520, 526, 535, 546, 565, 576, 586, 591, 681, 720, 730, 745, 750, 766, 855, 871, 906, 916, 951, 975, 1081, 1120
Offset: 1

Views

Author

Keywords

Examples

			2 is in the sequence because 2^2 + 1^2 = 5 and 2^2 - 1^2 = 3 are both prime.
3 is in the sequence because 3^2 + 2^2 = 13 and 3^2 - 2^2 = 5 are both prime.
		

Crossrefs

Cf. A068501.

Programs

  • Mathematica
    lst={};Do[If[PrimeQ[n^2-(n-1)^2]&&PrimeQ[n^2+(n-1)^2],AppendTo[lst,n]],{n,7!}];lst
    Select[Range[8!], PrimeQ[#^2 -(#-1)^2] && PrimeQ[#^2 +(#-1)^2] &] (* G. C. Greubel, Jan 28 2019 *)
  • PARI
    A178659()={my(maxx=1000);n=2;ptr=0;
    while(n<=maxx,q1=n^2-(n-1)^2;q2=n^2+(n-1)^2;
    if(isprime(q1)&&isprime(q2),ptr++;write("b178659.txt",ptr,"  ",n));n++); } \\ Bill McEachen, Jun 13 2014

Formula

a(n) = 1 + A068501(n). - Zak Seidov, Feb 10 2015