Fix incorrect (isPrime p) for small primes p.