Created
January 3, 2015 17:05
-
-
Save ebartrum/391493c9dfa2d703ed63 to your computer and use it in GitHub Desktop.
Euler9
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
#Define a function pyth(a,b,c) which returns true if a^2+b^2=c^2 | |
def pyth(a,b,c): | |
if a**2+b**2==c**2: | |
return True | |
else: | |
return False | |
#first check (1,x,y) | |
for i in range(0,1000): | |
for x in range(i,500): | |
if pyth(i,x,1000-x-i): | |
print(str(i)+" "+str(x)+" "+str(1000-x-i)) | |
#The answer is 200 375 425, whose product is 31875000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment