OFFSET
1,1
COMMENTS
A subsequence of A162164.
FORMULA
EXAMPLE
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.
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
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
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:
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:
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
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]; 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 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Jun 26 2009, Jun 27 2009
EXTENSIONS
Definition corrected, Mathematica duplicate removed, missing values added by R. J. Mathar, Jul 02 2009
STATUS
approved