Skip to content

Commit

Permalink
Optmization of problem 9
Browse files Browse the repository at this point in the history
  • Loading branch information
shabda committed Jul 3, 2011
1 parent 6aee375 commit df0ef90
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions euler9.py
Expand Up @@ -13,12 +13,12 @@ def find_required_pythagorean_triplet():
requiredNumber=0
for a in range(1,1000):
for b in range(a+1,1000):
for c in range(b+1,1000):
if(is_pythagorean_triplet(a,b,c) and is_sum_thousand(a,b,c)):
#if((a**2+b**2==c**2) and (a+b+c==1000)):
requiredNumber=a*b*c
print ("Product abc for only pythagorean triplet for which a+b+c is 1000 is {0}".format(requiredNumber))
return
c=1000-(a+b)
if(is_pythagorean_triplet(a,b,c)):
#if((a**2+b**2==c**2) and (a+b+c==1000)):
required_number=a*b*c
print ("Product abc for only pythagorean triplet for which a+b+c is 1000 is {0}".format(required_number))
return

find_required_pythagorean_triplet()
#print is_pythagorean_triplet(3,4,7)
Expand Down

0 comments on commit df0ef90

Please sign in to comment.