isPrime will work with primes close to 2^63-1 on 64-bit machines