Skip to content

Instantly share code, notes, and snippets.

@2GMon
Created August 3, 2012 09:27
Show Gist options
  • Save 2GMon/3246273 to your computer and use it in GitHub Desktop.
Save 2GMon/3246273 to your computer and use it in GitHub Desktop.
triangularNumbers :: [Int]
triangularNumbers = [sum [1..x] | x <- [1..]]
divisors :: Int -> [Int]
divisors x = filter (\n -> x `mod` n == 0) [1..x]
main = print $ head [triNum | triNum <- triangularNumbers, length (divisors triNum) >= 501]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment