#wilson's theorem in cpp
Explore tagged Tumblr posts
Text
Wilson's Theorem in C++
Wilson's Theorem states that for a prime number pp, (p−1)!≡−1 (mod p)(p - 1)! \equiv -1 \ (\text{mod} \ p). In C++, we can implement this theorem by calculating the factorial of p−1p - 1 and then finding its remainder when divided by pp. If the result is -1, pp is prime. The theorem is often used in primality testing algorithms.
Visit our website: https://www.tpointtech.com/wilsons-theorem-in-cpp
0 notes