Created
April 18, 2012 07:46
-
-
Save hatashiro/2411819 to your computer and use it in GitHub Desktop.
Projecteuler #9
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
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