Created
September 14, 2015 20:42
-
-
Save Frost/f648c01c1a48479c1036 to your computer and use it in GitHub Desktop.
38.hs
This file contains hidden or 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
-- 38 is the sum of the squares of the first three primes | |
-- 38 is 83 backwards | |
-- 83 is the sum of the squares of the first three odd primes | |
main = do | |
let primes = [2,3,5,7] | |
putStrLn $ show . sum . map square $ take 3 primes | |
putStrLn $ reverse . show . sum . map square $ drop 1 primes | |
where | |
square n = n * n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exemplarisk haskellkod!