Skip to content

Instantly share code, notes, and snippets.

@rhysd
Created August 3, 2012 06:38
Show Gist options
  • Save rhysd/3245151 to your computer and use it in GitHub Desktop.
Save rhysd/3245151 to your computer and use it in GitHub Desktop.
import Data.List
factors :: Int -> [Int]
factors n = filter (\x -> n `mod` x == 0) [1..n]
triNums :: [Int]
triNums = [ sum [1..x] | x<-[1..] ]
main = print $ find (\x -> length(factors x) > 500) triNums
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment