Created
February 23, 2013 05:31
-
-
Save tamurashingo/5018596 to your computer and use it in GitHub Desktop.
Project Euler 6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
1~100までの二乗の和と、1~100までの和の二乗との差分を求める。 | |
1~100までの二乗の和 | |
foldl (+) 0 $ map (^ 2) [1..100] | |
1~100までの和の二乗 | |
(^ 2) $ foldl (+) 0 [1..100] | |
-} | |
let | |
a = foldl (+) 0 $ map (^ 2) [1..100] | |
b = (^ 2) $ foldl (+) 0 [1..100] | |
in | |
b - a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment