8 lines
365 B
Haskell
8 lines
365 B
Haskell
-- The sequence of triangle numbers is generated by adding the natural numbers.
|
|
-- So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. ...
|
|
-- What is the value of the first triangle number to have over five hundred divisors?
|
|
import Euler
|
|
|
|
triangles = scanl1 (+) [1..] :: [Int]
|
|
main = print $ head $ [ n | n <- triangles, length (divisors n) > 500 ]
|