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 individually be written as a sum of 2 and also as a sum of 3 distinct nonzero squares.
0

%I #9 Feb 24 2019 20:03:10

%S 179,467,739,809,1097,1171,1619,1801,1873,1907,2467,3203,3331,3491,

%T 3923,4051,4177,4211,4931,5507,5651,6067,6121,6353,6569,6659,7219,

%U 8081,8243,8297,8353,8819,9091,9161,9377,10243,10531,10657,10729,10889,11251,11699

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

%C A subsequence of A162164.

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

%e p=12113: p-1=12112 = 36^2+40^2+96^2 = 36^2+104^2; p+1=12114 = 33^2+63^2+84^2 = 33^2+105^2.

%e p=4177: p-1=4176 = 24^2+60^2 = 24^2+36^2+48^2; p+1=4178 = 37^2+53^2 = 37^2+28^2+45^2. - _Vladimir Joseph Stephan Orlovsky_, Jun 26 2009

%e p=179: p-1=178 = 3^2+13^2 = 3^2+5^2+12^2; p+1=180 = 6^2+12^2=4^2+8^2+10^2. - _R. J. Mathar_, Jul 02 2009

%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 isA004432 := proc(n) local x,y,z ; for x from 1 do if x^2 > n then RETURN(false); fi; for y from x+ 1 do if x^2+y^2>n then break ; fi; z := n-x^2-y^2 ; if z> 0 and issqr(z ) then z := sqrt(z) ; if z > y and z > x then RETURN(true) ; fi; fi; od: od: end:

%p for n from 1 to 2000 do p := ithprime(n) ; if isA004432(p-1) and isA004432(p+1) and 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];x=p-1;y=p+1;If[f[x]> 0&&f[y]>0,a=x-(f[x])^2;b=y-(f[y])^2;If[f[a]>0&&f[b]>0,c=(x-(f[x])^2-(f[a])^2)^(1/ 2);d=(y-(f[y])^2-(f[b])^2)^(1/2);If[c!=f[x]&&c!=f[a]&&f[x]!=f[a], If[d!=f[y]&&d!=f[b]&&f[y]!=f[b],AppendTo[lst,p]]]]],{n,3,6*6!}];lst (* _Vladimir Joseph Stephan Orlovsky_, Jun 26 2009 *)

%K nonn

%O 1,1

%A _Vladimir Joseph Stephan Orlovsky_, Jun 26 2009, Jun 27 2009

%E Definition corrected, Mathematica duplicate removed, missing values added by _R. J. Mathar_, Jul 02 2009