Skip to content

Instantly share code, notes, and snippets.

@hatashiro
Created April 18, 2012 07:46
Show Gist options
  • Save hatashiro/2411819 to your computer and use it in GitHub Desktop.
Save hatashiro/2411819 to your computer and use it in GitHub Desktop.
Projecteuler #9
def isPythagorean(a, b, c):
return a**2 + b**2 == c**2
a = 1
b = 500
while True:
if isPythagorean(a, b, 1000-a-b):
break
else:
b = b+1
if a + b > 666:
a = a + 1
b = 501 - a
if a > 334:
break
print a*b*(1000-a-b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment