From 6a4b9beaca9caff4472b613e21624f0ef674fb5c Mon Sep 17 00:00:00 2001 From: Dmytro Meleshko Date: Wed, 27 Nov 2019 09:32:23 +0200 Subject: [PATCH] [scripts] fix factors function in pycalc --- scripts/pycalc_startup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/pycalc_startup.py b/scripts/pycalc_startup.py index 1b65c59..7f97f03 100644 --- a/scripts/pycalc_startup.py +++ b/scripts/pycalc_startup.py @@ -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