day1/exercise/pytriads.py
changeset 354 5dc6c3673f9d
parent 94 8c92864c184b
child 380 669b72283b55
--- a/day1/exercise/pytriads.py	Sun Jan 10 23:09:00 2010 +0530
+++ b/day1/exercise/pytriads.py	Tue Jan 12 19:03:34 2010 +0530
@@ -10,12 +10,8 @@
     else:
         return gcd(b, a%b)
 
-a = 3
-while a < 100:
-    b = a + 1
-    while b < 100:
-        is_ps, c = is_perfect_square((a * a) + (b * b))
-        if is_ps and gcd(a, b) == 1:
-            print a, b, c
-        b += 1
-    a += 1
+for a in range(3, 501):
+    for b in range( a+1, 501, 2):
+        if gcd( a, b ) == 1:
+            is_ps, c = is_perfect_square((a * a) + (b * b))
+            if is_ps: print a, b, c