-
-
Save mpetyx/1427c63ab6b6d099fee7 to your computer and use it in GitHub Desktop.
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
__author__ = 'mpetyx' | |
''' Pythagorean triplets are integers (a, b, c) for which the property | |
a^2 + b^2 = c^2 holds. The following script is a dummy implementation that runs in 12.5s ''' | |
lim = 500 | |
for i in range(1, lim): | |
for j in range(i+1, lim): | |
for k in range(j+1, lim): | |
if i**2 + j**2 == k**2: | |
print i, j, k |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment