diff options
Diffstat (limited to 'Demo/scripts/fact.py')
-rwxr-xr-x | Demo/scripts/fact.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Demo/scripts/fact.py b/Demo/scripts/fact.py index 6aac414..b406086 100755 --- a/Demo/scripts/fact.py +++ b/Demo/scripts/fact.py @@ -12,17 +12,17 @@ error = 'fact.error' # exception def fact(n): if n < 1: raise error # fact() argument should be >= 1 - if n = 1: return [] # special case + if n == 1: return [] # special case res = [] # Treat even factors special, so we can use i = i+2 later - while n%2 = 0: + while n%2 == 0: res.append(2) n = n/2 # Try odd numbers up to sqrt(n) limit = sqrt(n+1) i = 3 while i <= limit: - if n%i = 0: + if n%i == 0: res.append(i) n = n/i limit = sqrt(n+1) |