I have defined the function that counts the number of square divisors of input integer x. The function is


Now when computing the average number of square divisors cases at H = 10000000 I get


Divisors::argx: Divisors called with 0 arguments; 1 argument is expected.

When tested for smaller values, say 10^3, 10^4, 10^5, 10^6 I get the proper sum. So at 10^7 the Divisors function is claiming that it is called with zero arguments. How can this occur?

Is this an error in Mathematica or something else?

I have tested this on two difference computers using the latest version of Mathematica.

  • $\begingroup$ does SetSystemOptions["SymbolicSumThreshold" -> 10000000]; N[Sum[NumberOfSquareDivisors[i], {i, 1, 10000000}]/10000000] work? $\endgroup$
    – kglr
    Sep 4, 2020 at 4:04
  • $\begingroup$ Yes that did work. Now I am at work using the cloud and the calculation exceed my time limit, but this tells me that it was computing the sum without the error. $\endgroup$ Sep 4, 2020 at 4:08

1 Answer 1


When the length of the sum exceeds 10^6, Sum will try to compute the result symbolically. This symbolic computation fails miserably for your function, generating errors. You can see this for smaller values by setting a system option:



Divisors::argx: Divisors called with 0 arguments; 1 argument is expected.


Clearly, trying to perform a symbolic sum of a user defined function is unlikely to work. You can avoid this by raising the threshold:



However, I don't have the patience to wait for this to finish. You can reset to the default with:

  • $\begingroup$ That makes sense, however it was unexpected. At least I get an error/warning condition. I do use user defined functions with sums in many cases, however, the sum limits are usually small so I have not seen this condition until now. $\endgroup$ Sep 4, 2020 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.