Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- main = print . sum . map fst . filter (uncurry (<=)) $ sums
- sums = map (\x -> (x, sum (divisors x))) candidates
- where candidates = [1..48] ++ [49,51..20161]
- divisors n = ds ++ map (n `div`) (init ds)
- where ds = [d | d <- [1..sqrt' n], n `mod` d == 0]
- sqrt' = truncate . sqrt . fromIntegral
Advertisement
Add Comment
Please, Sign In to add comment