Skip to content

Instantly share code, notes, and snippets.

@dionyziz
Last active April 3, 2019 12:08
Show Gist options
  • Save dionyziz/71755d7cb008cd22d29e27eba4921016 to your computer and use it in GitHub Desktop.
Save dionyziz/71755d7cb008cd22d29e27eba4921016 to your computer and use it in GitHub Desktop.
import Control.Monad (guard)
triplets :: [[Int]]
triplets = do
a <- [1..998]
b <- [a+1..998]
let c = 1000 - a - b
guard $ a^2 + b^2 == c^2
return [a, b, c]
main = print $ product $ head $ triplets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment