changeset 380 | 669b72283b55 |
parent 94 | 8c92864c184b |
--- a/day1/exercise/amicable.py Mon Mar 08 20:45:33 2010 +0530 +++ b/day1/exercise/amicable.py Thu Mar 11 18:01:23 2010 +0530 @@ -1,15 +1,8 @@ -def is_perfect_square(n): - i = 1 - while i * i < n: - i += 1 - return i * i == n, i - def aliquot(n): sum = 1 i = 2 - is_ps, root = is_perfect_square(n) - while i < root: + while i * i < n: if n % i == 0: sum += i + (n / i) i += 1