Skip to content

Instantly share code, notes, and snippets.

@mpetyx
Forked from VHarisop/pytriplets
Last active August 29, 2015 14:07
Show Gist options
  • Save mpetyx/1427c63ab6b6d099fee7 to your computer and use it in GitHub Desktop.
Save mpetyx/1427c63ab6b6d099fee7 to your computer and use it in GitHub Desktop.
__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