Fermat Primality Test
The Fermat Primality Test is a method used to determine if a number is prime. It is based on Fermat's Little Theorem, which states that if p is a prime number and a is an integer not divisible by p , then a^(p-1) \equiv 1 \mod p . The test involves selecting random integers a and checking if the theorem holds true for them.
If the condition fails for any chosen a , the number is definitely composite. However, if it holds for several values of a , the number is likely prime, though it may still be composite. This test is efficient but can produce false positives, so it is often used alongside other tests for greater accuracy.