Closed teofr closed 2 years ago
Hello Teodoro,
Thank you for brining this to my attention! Indeed, the bug is in factor.py
- I got the indentation of everything following the print
statement wrong so a number would only be further factorized with Pollard Rho and ECM if verbose = True
.
The code block in lines 104-109 should instead read:
if verbose:
print "Found factor", str(g)
f1 = merge_factorizations(factorize(g, verbose = verbose, level = 2), \
factorize(n/g, verbose = verbose, level = 2))
if f1 != -1:
f.extend(f1)
while, similarly, the code block in lines 118-125 should be:
if verbose:
print "Found factor", str(g)
f1 = merge_factorizations(factorize(g, verbose = verbose, level = 2), \
factorize(n/g, verbose = verbose, level = 2))
if f1 != -1:
f.extend(f1)
else:
f = -1
I don't have access rights to my repository anymore to commit the fix for some odd reason, so while I figure that issue out, you could patch your local copy with these fixes.
Cheers!
Sorry this took so long - fixed!
The function
factorize
has a bug, in particular, if asked to factorize 18846316186591 it returns 1097 as its sole factor. However, if run with the verbose flag set, it works as expected. I'll try to find the reason if I have some time, it seems to be related to the Pollard Rho algorithm.