From eecb37127f6deac359d798abdbe5108e1d36e522 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Mon, 12 Apr 2010 15:53:07 +0000 Subject: [PATCH] Problem 009 git-svn-id: file:///srv/svn/euler@28 e5f4c3ec-3c0c-11df-b522-21efaa4426b5 --- 009.py | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 009.py diff --git a/009.py b/009.py new file mode 100644 index 0000000..a840583 --- /dev/null +++ b/009.py @@ -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