fix foldr bug in isprime