# Pastebin fEhcPysw isPrime :: Integer -> Bool isPrime n | even n = False | any factor [2..isqrt n] = False | otherwise = True where -- The type signatures on `factor` and `isqrt` -- are not really required here, but might make -- it easier to read factor :: Integer -> Bool factor x = n `mod` x == 0 isqrt :: Integer -> Integer isqrt x = ceiling (sqrt (fromIntegral x :: Double))