Kaydet (Commit) 3a585bb9 authored tarafından Guido van Rossum's avatar Guido van Rossum

small fixes

üst 9a6757da
...@@ -19,7 +19,7 @@ def fact(n): ...@@ -19,7 +19,7 @@ def fact(n):
res.append(2) res.append(2)
n = n/2 n = n/2
# Try odd numbers up to sqrt(n) # Try odd numbers up to sqrt(n)
limit = sqrt(n+1) limit = sqrt(float(n+1))
i = 3 i = 3
while i <= limit: while i <= limit:
if n%i == 0: if n%i == 0:
...@@ -28,7 +28,8 @@ def fact(n): ...@@ -28,7 +28,8 @@ def fact(n):
limit = sqrt(n+1) limit = sqrt(n+1)
else: else:
i = i+2 i = i+2
res.append(n) if n != 1:
res.append(n)
return res return res
def main(): def main():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment