Bug introduced in 12.0.0 or earlier. Fixed in 13.2.0 or earlier.

In Mathematica when I input one of these:





notebook keeps running unevaluated forever. Notice that 127-th zeta zero is the first zero that violates the Gram's law (Gram points). So I guess this fact could have something to do with this bug. Log[2/Im[ZetaZero[129]]] is evaluated correctly.

Can you reproduce the bug? Is it the same with newer versions of Mathematica?


Better way to reproduce the bug:

Evaluate it on a fresh kernel - quit kernel, then type something simple like 2+2 to restart kernel and then type the code

Table[Log[Im[ZetaZero[n + 1]]/Im[ZetaZero[n]]], {n, 1, 128}] // N

It will keep running forever.

  • $\begingroup$ It evaluates instantly in "12.3.1 for Microsoft Windows (64-bit) (June 24, 2021)" to $-4.95041$ and $-4.95305$. $\endgroup$
    – Domen
    Sep 17, 2021 at 19:57
  • $\begingroup$ Can you evaluate Table[Log[Im[ZetaZero[n + 1]]/Im[ZetaZero[n]]], {n, 1, 128}] // N. How long does it take on your version? $\endgroup$ Sep 17, 2021 at 20:00
  • 1
    $\begingroup$ When I tried it before, it took 13 seconds on the first run and 6 seconds for subsequent runs (probably because of some internal caching). However, on a fresh kernel, it does seem to get stuck! $\endgroup$
    – Domen
    Sep 17, 2021 at 20:11
  • 1
    $\begingroup$ I'm able to reproduce the hanging Table call in V12.3. $\endgroup$
    – Greg Hurst
    Sep 18, 2021 at 0:36
  • 1
    $\begingroup$ All command run fine in 13.2.0 on a mac; see screenshot $\endgroup$
    – bmf
    Feb 10, 2023 at 11:45

1 Answer 1



This issue seems to be related to caching of previous numerical values. If we clear the cache during each iteration we get a result back:

  N[Log[Im[ZetaZero[n + 1]]/Im[ZetaZero[n]]]], 
  {n, 1, 128}
]; // AbsoluteTiming
{6.8104, Null}

What to do

Report this to WRI.

It's strange that N[ZetaZero[128]] works, but iterating up to it in a Table breaks it.


After some investigation through GeneralUtilities`PrintDefinitions it seems we're getting stuck in an infinite While loop in System`FunctionZerosDump`NZetaZeroApprox.

The While loop is towards the bottom of the definition:

enter image description here

In our case, m == 4969178850004113/17592186044416, p == ∞, and hence eps = 0.

This makes our While loop spin forever, continually multiplying 2*0.

Offending call:

The offending call is

System`FunctionZerosDump`NZetaZeroApprox[127, {∞, 16.255619765854984`}]

where p above is from System`FunctionZerosDump`NZetaZeroApprox[k, {p, a}].

Changing p to something like 100 gives us a result.

Looking through NValues for ZetaZero, the only way p could be is if we make the call N[ZetaZero[127], {∞, a}] -- which we are not.

  • $\begingroup$ Thanks for detailed analysis. This bug persists in Mathematica from earlier versions. It was version 7 or 8 if I remember correctly when I started to use Mathematica, and the bug was already there. I even think that I reported this bug a long time ago but nothing happened. At least now I know how to avoid the bug - precompute values of required zeros and then use them instead of using ZetaZero. $\endgroup$ Sep 18, 2021 at 10:57

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.