diff options
Diffstat (limited to 'Math.hs')
-rw-r--r-- | Math.hs | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -1,12 +1,9 @@ module Math where isPrime :: Int -> Bool + factors :: Int -> [Int] + intersect' :: [Int] -> [Int] -> [Int] isPrime n = (length [ x | x <- [2..(ceiling $ sqrt $ fromIntegral 2)], n `mod` x == 0]) == 0 - - factors :: Int -> [Int] - factors n = [x | x <- [1..(n `div` 2)], n `mod` x == 0] ++ [n] - - intersect' :: [Int] -> [Int] -> [Int] intersect' a b = [x | x <- a, x `elem` b] |