Prime numbers play a crucial role in modern cryptography, necessitating fast and accurate primality-testing methods. The Miller-Rabin algorithm is an efficient probabilistic method; however, the literature discussing its practical implementation and empirical evaluation remains limited. This study aimed to implement the Miller-Rabin algorithm using Python and evaluate its classification accuracy and execution time. This implementative research tested prime and composite numbers of sizes 32, 64, 128, 256, and 512 bits. The algorithm was implemented using Python's built-in pow() function for efficient modular exponentiation. The experimental results demonstrated that the implemented Miller–Rabin algorithm correctly identified all prime numbers as probably prime and all composite numbers as composite in all test cases. Furthermore, the computational time evaluation revealed that the execution time was directly proportional to the bit length of the numbers and the number of testing iterations. This execution time remains highly efficient for numbers of up to 512 bits. The implications of this research highlight that the Python implementation of Miller-Rabin is highly effective, serving as an excellent educational medium and a foundational tool for developing systems requiring large prime number testing.
Copyrights © 2026