mirror of
https://github.com/correl/euler.git
synced 2024-11-30 11:09:52 +00:00
Problem 009
git-svn-id: file:///srv/svn/euler@28 e5f4c3ec-3c0c-11df-b522-21efaa4426b5
This commit is contained in:
parent
743dbe3aef
commit
eecb37127f
1 changed files with 9 additions and 0 deletions
9
009.py
Normal file
9
009.py
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
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
|
Loading…
Reference in a new issue