Last active
August 29, 2015 14:06
-
-
Save Isweet/5e47f06cf634f5c93908 to your computer and use it in GitHub Desktop.
Generator for all pythagorean triples s.t. r < bound
This file contains 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
# Generator for all pythagorean triples s.t. r < bound | |
def pyth_triples(bound): | |
for r in range(2, bound): | |
for s in range(1, r): | |
yield [r*r - s*s, 2*r*s, r*r + s*s] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment