Miller-Rabin implementation and Trial division in python