From 68d683e6e2443c5e512ab2d7cc7c006a6bb372c5 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sat, 26 Jun 2021 14:38:59 +0100 Subject: (Code)~rearrange definitions and code in Math module --- Math.hs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Math.hs b/Math.hs index b1eac91..ddeac32 100644 --- a/Math.hs +++ b/Math.hs @@ -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] -- cgit v1.2.3-13-gbd6f