is_prime_brute_force attempts to divide every number up until the square root of the number to check for primality. There are a few optimizations such as checking if the number is divisible by 2 and 3 at the start which allows it to start checking numbers starting at 5. This function is not efficient and there are quicker methods for checking if a number is prime.
is_prime_fermat determines whether a given integer \( n \) is a prime number using Fermat's primality test. It iterates through a specified number of iterations, each time randomly selecting a base a between 2 and \( n - 1 \). For each iteration, it checks if \( a^n \mod n \) is equal to \( a \). If any of these checks fail, the function immediately returns False, indicating that n is composite. If all iterations pass, the function returns True, indicating that n is likely prime according to Fermat's primality test.
is_prime_rabin_miller probabilistically tests whether a given integer \( n \) is prime. It performs \( k \) iterations, each time randomly selecting a base \( a \) and checking whether \( n \) passes the Miller-Rabin primality test with that base. The more iterations performed (i.e., higher \( k \)), the more accurate the primality test becomes.