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.

A162164 Primes p such that p-1 and p+1 can be written as a sum of 2 distinct nonzero squares.

Original entry on oeis.org

179, 233, 467, 521, 739, 809, 1097, 1171, 1601, 1619, 1801, 1873, 1907, 2467, 3203, 3329, 3331, 3491, 3923, 4051, 4177, 4211, 4931, 5507, 5651, 6067, 6121, 6353, 6569, 6659, 7219, 8081, 8243, 8297, 8353, 8819, 9091, 9161, 9377, 10243, 10531, 10657
Offset: 1

Views

Author

Keywords

Examples

			p=179 is a term because 179 - 1 = 3^2 + 13^2 and 179 + 1 = 6^2 + 12^2.
		

Programs

  • Maple
    isA004431 := proc(n) local x,y ; for x from 1 do if x^2 > n then RETURN(false); fi; y := n-x^2 ; if y> 0 and issqr(y ) then y := sqrt(y) ; if y <> x then RETURN(true) ; fi; fi; od: end:
    for n from 1 to 2000 do p := ithprime(n) ; if isA004431(p-1) and isA004431(p+1) then printf("%d,",p) ; fi; od: # R. J. Mathar, Jul 02 2009
  • Mathematica
    f[n_]:=Module[{k=1},While[(n-k^2)^(1/2)!=IntegerPart[(n-k^2)^(1/2)],k++; If[2*k^2>=n,k=0;Break[]]];k]; lst={};Do[p=Prime[n];If[f[p-1]>0&&f[p+1]> 0,AppendTo[lst,p]],{n,4*6!}];lst

Formula

{p=A000040(i): p-1 in A004431 and p+1 in A004431}. - R. J. Mathar, Jul 02 2009

Extensions

Definition corrected, R. J. Mathar, Jul 02 2009