Fermat's 4 n+1 Theorem

Author

Eric W. Weisstein
March 16, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/PrimeNumbers/Fermats4nPlus1Theorem.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/Fermats4nPlus1Theorem.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Enumeration

reps=Reduce[x^2+y^2==#&&0<x<=y&&(x|y)∈Integers,{x,y}]&/@Prime[Range[100]]

p=Position[reps,_?(FreeQ[#,(False|Or)]&),{1},Heads->False]//Flatten

Mod[Prime/@p,4]

xy=Transpose[(Last/@#)&/@List@@@reps[[p]]]