Last active
May 24, 2017 12:24
-
-
Save thieux/fb81c135c54198ba0ca61999360280be to your computer and use it in GitHub Desktop.
A brute force approach to generate pythagorean triples in Python 3
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
MAX = 100 | |
pythagorean_triples = [(a, b, c) for a in range(2, MAX) for b in range(2, MAX) for c in range(2, MAX) if a*a + b*b == c*c] | |
print(pythagorean_triples) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment