Skip to content

Commit

Permalink
hack to make primefac terminate when no method is given
Browse files Browse the repository at this point in the history
  • Loading branch information
gilcu3 committed May 12, 2024
1 parent c1452e8 commit 25e854a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion discretelog/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,16 @@ def factor(n, DEBUG=False):
ps = []
try:
for p in primefac(n, trial=10**4, rho=2 * 10**5,
methods=tuple(), verbose=DEBUG):
methods=None, verbose=DEBUG):
if isprime(p):
n //= p
ps += [p]
else:
break
except AssertionError:
pass
except TypeError:
pass
if n > 1:
for p in factor_yafu(n, pretest=True, DEBUG=DEBUG):
if isprime(p):
Expand Down

0 comments on commit 25e854a

Please sign in to comment.