Skip to content

Instantly share code, notes, and snippets.

@nwjsmith
Created June 23, 2011 14:31
Show Gist options
  • Save nwjsmith/1042642 to your computer and use it in GitHub Desktop.
Save nwjsmith/1042642 to your computer and use it in GitHub Desktop.
pyths :: Int -> [(Int, Int, Int)]
pyths n = [(x, y, z) | x <- [1..n], y <- [1..n], z <- [1..n], arePyths x y z]
where arePyths x y z = x ^ 2 + y ^ 2 == z ^ 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment