Miller-Rabin primality test