Wilson's Theorem - GeeksforGeeks
www.geeksforgeeks.org › wilsons-theoremDec 15, 2015 · Wilson’s theorem states that a natural number p > 1 is a prime number if and only if (p - 1) ! ≡ -1 mod p OR (p - 1) ! ≡ (p-1) mod p Examples: p = 5 (p-1)! = 24 24 % 5 = 4 p = 7 (p-1)! = 6! = 720 720 % 7 = 6 How does it work? 1) We can quickly check result for p = 2 or p = 3.
Wilson's theorem - Wikipedia
en.wikipedia.org › wiki › Wilson&Wilson's theorem. In algebra and number theory, Wilson's theorem states that a natural number n > 1 is a prime number if and only if the product of all the positive integers less than n is one less than a multiple of n. That is (using the notations of modular arithmetic ), the factorial. exactly when n is a prime number.
Wilson's Theorem | Brilliant Math & Science Wiki
brilliant.org › wiki › wilsons-theoremWilson's theorem states that . a positive integer n > 1 n > 1 n > 1 is a prime if and only if (n − 1)! ≡ − 1 (m o d n) (n-1)! \equiv -1 \pmod {n} (n − 1)! ≡ − 1 (m o d n). In other words, (n − 1)! (n-1)! (n − 1)! is 1 less than a multiple of n n n. This is useful in evaluating computations of (n − 1)! (n-1)! (n − 1)!, especially in Olympiad number theory problems.