There was an error while loading. Please reload this page.
1 parent 9a6757d commit 3a585bbCopy full SHA for 3a585bb
1 file changed
Demo/scripts/fact.py
@@ -19,7 +19,7 @@ def fact(n):
19
res.append(2)
20
n = n/2
21
# Try odd numbers up to sqrt(n)
22
- limit = sqrt(n+1)
+ limit = sqrt(float(n+1))
23
i = 3
24
while i <= limit:
25
if n%i == 0:
@@ -28,7 +28,8 @@ def fact(n):
28
limit = sqrt(n+1)
29
else:
30
i = i+2
31
- res.append(n)
+ if n != 1:
32
+ res.append(n)
33
return res
34
35
def main():
0 commit comments