Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ebartrum/391493c9dfa2d703ed63 to your computer and use it in GitHub Desktop.
Save ebartrum/391493c9dfa2d703ed63 to your computer and use it in GitHub Desktop.
Euler9
#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