euler/haskell/euler006.hs

9 lines
181 B
Haskell

module Main where
sum_of_squares n = sum $ map (\m -> m * m) [1..n]
square_of_sum n = (\m -> m * m) (sum [1..n])
main = do
print $ (square_of_sum 100) - (sum_of_squares 100)