威尔逊定理当 ( p − 1 ) ! ≡ − 1 ( m o d p ) (p−1)!≡−1(modp)(p−1)!≡−1(modp)时,p pp为素数。p ∣ ( p − 1 ) ! + 1 p∣(p−1)!+1p∣(p−1)!+1即( p − 1 ) ! ≡ ( p − 1 ) ≡ − 1 ( m o d p ) (p−1)!≡(p−1)≡−1(mod p)(p−1)!≡(p−1)≡−1(modp)证明(静下心看):充分性:( p − 1 ) ! ≡ − 1 ( m o d p ) ⟺ p ∣ ( p − 1 ) ! + 1 (p−1)!≡−1(modp)⟺p∣(p−1)!+1(p−1)!≡−1(modp)⟺p∣(p−1)!+1假设p pp 不是质数,且 a aa是 p pp 的质因子。易知a ∣ ( p − 1 ) ! a∣(p−1)!a∣(p−1)!,则a ∤ ( p − 1 ) ! + 1 a∤(p−1)!+1a∤(p−1)!+1而p ∣ ( p − 1 ) ! + 1 ⟹ a ∣ ( p − 1 ) ! + 1 p∣(p−1)!+1⟹a∣(p−1)!+1p∣(p−1)!+1⟹a∣(p−1)!+1,前后矛盾!故 p pp 一定为质数。必要性:必要性: