Skip to content

Commit 3a585bb

Browse files
committed
small fixes
1 parent 9a6757d commit 3a585bb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Demo/scripts/fact.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def fact(n):
1919
res.append(2)
2020
n = n/2
2121
# Try odd numbers up to sqrt(n)
22-
limit = sqrt(n+1)
22+
limit = sqrt(float(n+1))
2323
i = 3
2424
while i <= limit:
2525
if n%i == 0:
@@ -28,7 +28,8 @@ def fact(n):
2828
limit = sqrt(n+1)
2929
else:
3030
i = i+2
31-
res.append(n)
31+
if n != 1:
32+
res.append(n)
3233
return res
3334

3435
def main():

0 commit comments

Comments
 (0)