mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
small fixes
This commit is contained in:
parent
9a6757dade
commit
3a585bb964
1 changed files with 3 additions and 2 deletions
|
@ -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,6 +28,7 @@ def fact(n):
|
||||||
limit = sqrt(n+1)
|
limit = sqrt(n+1)
|
||||||
else:
|
else:
|
||||||
i = i+2
|
i = i+2
|
||||||
|
if n != 1:
|
||||||
res.append(n)
|
res.append(n)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue