The Fermat number is prime iff
Pépin's Theorem
See also
Fermat Number, Pépin's Test, Selfridge-Hurwitz ResidueExplore with Wolfram|Alpha
Cite this as:
Weisstein, Eric W. "Pépin's Theorem." From MathWorld--A Wolfram Web Resource. https://mathworld.wolfram.com/PepinsTheorem.html