Skip to content

Instantly share code, notes, and snippets.

@Frost
Created September 14, 2015 20:42
Show Gist options
  • Save Frost/f648c01c1a48479c1036 to your computer and use it in GitHub Desktop.
Save Frost/f648c01c1a48479c1036 to your computer and use it in GitHub Desktop.
38.hs
-- 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
@eskilandreen
Copy link

Exemplarisk haskellkod!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment