Wilson's theorem (another Prime Pages' Glossary entries) Glossary: Prime Pages: Top 5000: GIMPS has discovered a new largest known prime number: 282589933-1 (24,862,048 digits)In 1770 Edward Waring announced the following theorem by his former student John Wilson. Wilson's Theorem. Let p be an integer greater than one. p is prime if and only if (p-1)! = -1 (mod p). This beautiful result is of mostly theoretical value because it is relatively difficult to calculate (p-1)! In contrast it is easy to calculate ap-1, so elementary primality tests are built using Fermat's Little Theorem rather than Wilson's Theorem. For example, the largest prime ever shown prime by Wilson's theorem is most likely 1099511628401, and even with a clever approach to calculating n!, this still took about one day on a SPARC processer. But numbers with ten's of thousands of digits have been shown prime using a converse of Fermat's theorem in a less than an hour. You might want to try your hand at proving the following corollary to Wilson's theorem: n is prime if and only if sin(((n-1)!+1)pi/n) is zero. See Also: WilsonPrimeRelated pages (outside of this work)References: CDP97 R. Crandall, K. Dilcher and C. Pomerance, "A search for Wieferich and Wilson primes," Math. Comp., 66:217 (1997) 433--449.  MR 97c:11004 (Abstract available) Chris K. Caldwell © 1999-2020 (all rights reserved)