mirror of
https://github.com/python/cpython.git
synced 2025-09-17 22:20:23 +00:00
#687648 from Robert Schuppenies: use classic division.
This commit is contained in:
parent
e91fcbdf69
commit
2a9b9cbea0
12 changed files with 33 additions and 33 deletions
|
@ -17,14 +17,14 @@ def fact(n):
|
|||
# Treat even factors special, so we can use i = i+2 later
|
||||
while n%2 == 0:
|
||||
res.append(2)
|
||||
n = n/2
|
||||
n = n//2
|
||||
# Try odd numbers up to sqrt(n)
|
||||
limit = sqrt(float(n+1))
|
||||
i = 3
|
||||
while i <= limit:
|
||||
if n%i == 0:
|
||||
res.append(i)
|
||||
n = n/i
|
||||
n = n//i
|
||||
limit = sqrt(n+1)
|
||||
else:
|
||||
i = i+2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue