mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[scripts] fix factors function in pycalc
This commit is contained in:
parent
87c8dc8113
commit
6a4b9beaca
1 changed files with 3 additions and 4 deletions
|
@ -5,10 +5,9 @@ from fractions import Fraction
|
|||
def factors(n):
|
||||
result = set()
|
||||
for i in range(1, int(sqrt(n)) + 1):
|
||||
div, mod = divmod(n, i)
|
||||
if mod == 0:
|
||||
result.add(div)
|
||||
result.add(mod)
|
||||
if n % i == 0:
|
||||
result.add(i)
|
||||
result.add(n // i)
|
||||
return result
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue