Guest User

Untitled

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