module IsPrime where isPrime :: Integer -> Bool isPrime x | x `elem` [2, 3, 5, 7] = True | x < 2 || even x = False | otherwise = not $ any (\n -> x `rem` n == 0) [3, 5..last] where last = (round . sqrt . fromIntegral) x