Wilson Prime

Author

Eric W. Weisstein
March 11, 2004

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

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

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

Code

WilsonPrimeQ[p_]:=Mod[(p-1)!,p^2]==p^2-1

Enumeration

(p=Position[Prime[Range[1000]],_?WilsonPrimeQ]//Flatten)//Timing

PrimePi[5 10^8]

Prime/@p