changeset 94 | 8c92864c184b |
parent 64 | 333092b68926 |
child 354 | 5dc6c3673f9d |
--- a/day1/exercise/pytriads.py Fri Oct 09 22:57:00 2009 +0530 +++ b/day1/exercise/pytriads.py Sun Oct 11 16:51:43 2009 +0530 @@ -10,9 +10,12 @@ else: return gcd(b, a%b) -for a in range(3, 100): - for b in range(a+1, 100): - ips, c = is_perfect_square((a * a) + (b * b)) - if ips and gcd(a, b) == 1: +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