add Millar-Rabin test and check if n is prime.