login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

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

%I #6 Feb 24 2019 21:09:17

%S 179,233,467,521,739,809,1097,1171,1601,1619,1801,1873,1907,2467,3203,

%T 3329,3331,3491,3923,4051,4177,4211,4931,5507,5651,6067,6121,6353,

%U 6569,6659,7219,8081,8243,8297,8353,8819,9091,9161,9377,10243,10531,10657

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

%F {p=A000040(i): p-1 in A004431 and p+1 in A004431}. - _R. J. Mathar_, Jul 02 2009

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

%p 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:

%p 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

%t 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

%K nonn

%O 1,1

%A _Vladimir Joseph Stephan Orlovsky_, Jun 26 2009

%E Definition corrected, _R. J. Mathar_, Jul 02 2009