Skip to content

Instantly share code, notes, and snippets.

@adamancini
Created September 21, 2012 18:05
Show Gist options
  • Save adamancini/3762994 to your computer and use it in GitHub Desktop.
Save adamancini/3762994 to your computer and use it in GitHub Desktop.
## euler9
# import euler9
# will give you access to the euler9 function from other scripts
# and wrapping everything else in a main() function and putting it
# after the if __name__ block will keep that code from being executed
# if the file is simply imported.
def euler9():
for k in range(0,33):
for j in range(0,1000):
for i in range(0,1000):
if i*i + j*j == k*k:
if i + j + k == 1000:
return i*j*k
def main():
print euler9()
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment