New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
divisor_sigma becomes sluggish over a range of values #14666
Comments
Yes, that is expected, When you factorize
I think, if it has to be fixed (in terms of usefulness), the sum of divisors |
@sidhantnagpal, that is not correct. OisinMoran's custom method also uses
As you can see despite being implemented identically, the built in divisor sigma function ( |
You mentioned someone else. I see your point. Your explanation gives an insight to the comparison of the two functions. |
I'm wondering why Answering my own question: it's so that you can use |
I was delighted to find sympy has a built-in
divisor_sigma
function as I had previously been using the following (which still uses sympy'sfactorint
):So when I found about the built-in function I was eager to delete my code and get some speedup in my program and on first glance the built-in version seemed several orders of magnitude faster than my previous implementation. Yet actually including it in my code made things much slower. I have narrowed it down to the simple results shown below:
The built-in function is orders of magnitude faster for any particular value, but if called over a range of values is orders of magnitude slower. And for larger ranges it starts to become completely unusable:
What could possibly be causing this and how could it be fixed? Thanks :)
The text was updated successfully, but these errors were encountered: