Tuesday, February 28, 2012

2012/027) What is (p - 1)! mod p when p is not prime? Wilson's Theorem (p - 1)! ≡ -1 (mod p) when p is prime

There are 2 cases.
1) P is not a perfect square of a prime. Then there are 2 unequal factors and product of them mod p = 0 hence 0

2) P is a square of a prime say q. Then product of q and next multiple of q ( that is 2q) mod p = 0

unless 2q = p where 2q goes outside the range For that 2q= p = q^2 => q = 2

P = 4 and (p-1)!mod p = 3! Mod 4 = 2

else if p is composite it is zero



No comments: