@anonymous/

AlarmedMuffledIrishwaterspaniel

Haskell

No description

fork
loading
Files
  • main.hs
main.hs
1
2
3
4
5
6
7
8
9
10
11
main :: IO ()
main = putStrLn (show (perfects))

perfects :: [Int]
perfects = [ n | n <- [1..1000], isPerfect n]

isPerfect :: Int -> Bool
isPerfect n = sum (divisors n) == n

divisors :: Int -> [Int]
divisors n = [ i | i <- [1..n-1], n `mod` i == 0]
GHCi, version 8.6.5