Fix non-termination of (isPrime 1).