diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2021-06-26 14:38:59 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2021-06-26 14:38:59 +0100 |
commit | 68d683e6e2443c5e512ab2d7cc7c006a6bb372c5 (patch) | |
tree | ac907e986f5c7a9f3ca412596ccd4b37bc951d26 /Math.hs | |
parent | 445915a8c72735e3f25cb697ce63c49890ca70f6 (diff) | |
download | numberdisplay-68d683e6e2443c5e512ab2d7cc7c006a6bb372c5.tar.gz numberdisplay-68d683e6e2443c5e512ab2d7cc7c006a6bb372c5.tar.bz2 numberdisplay-68d683e6e2443c5e512ab2d7cc7c006a6bb372c5.zip |
(Code)~rearrange definitions and code in Math module
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] |