Divisors

Run Settings
LanguageHaskell
Language Version
Run Command
module Divisors where divisors :: Integral a => a -> [a] divisors x = filter ((== 0) . mod x) [1 .. x] isPrime :: Integral a => a -> Bool isPrime = (== 2) . length . divisors main :: IO () main = do putStrLn "Get divisors of: " x <- getLine putStrLn $ unwords $ map show (divisors (read x)) putStrLn $ x ++ (if isPrime (read x) then " is " else " isn't ") ++ "a prime number."
Editor Settings
Theme
Key bindings
Full width
Lines