Speed up isprime for small inputs on no-montgomery-math machines