euler/e009.py
Correl Roush 5bbf86c6c3 Renaming exercise files so functions can be imported into other scripts
git-svn-id: file:///srv/svn/euler@31 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
2010-04-12 15:53:10 +00:00

9 lines
297 B
Python

TRIPLET_SUM = 1000
for c in range(TRIPLET_SUM - 3, 3, -2):
diff = TRIPLET_SUM - c
for x in range(1, int(diff / 2) + 1):
(a, b) = (x, diff - x)
if a**2 + b**2 == c**2:
print '{a}**2 + {b}**2 == {c}**2'.format(a=a, b=b, c=c)
print 'Product: ', a*b*c