# Zeta zeros bug in Mathematica 12.0.0.0

In Mathematica 12.0.0.0 when I input one of these:

Log[2/Im[ZetaZero[127]]]

Log[2/Im[ZetaZero[128]]]

Log[2/Im[ZetaZero[127]]]//N

Log[2/Im[ZetaZero[128]]]//N


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?

EDIT:

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.

• It evaluates instantly in "12.3.1 for Microsoft Windows (64-bit) (June 24, 2021)" to $-4.95041$ and $-4.95305$. Sep 17 at 19:57
• Can you evaluate Table[Log[Im[ZetaZero[n + 1]]/Im[ZetaZero[n]]], {n, 1, 128}] // N. How long does it take on your version? Sep 17 at 20:00
• Evaluate it on a fresh kernel. Qiut kernel, then type something simple like 2+2 to restart kernel and then type the code with the table I posted above. Sep 17 at 20:05
• 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! Sep 17 at 20:11
• I'm able to reproduce the hanging Table call in V12.3. Sep 18 at 0:36

Workaround:

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:

Table[
ClearSystemCache["Numeric"];
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.

Diagnosis:

After some investigation through GeneralUtilitiesPrintDefinitions it seems we're getting stuck in an infinite While loop in SystemFunctionZerosDumpNZetaZeroApprox.

The While loop is towards the bottom of the definition:

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

SystemFunctionZerosDumpNZetaZeroApprox[127, {∞, 16.255619765854984}]


where p above is from SystemFunctionZerosDumpNZetaZeroApprox[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.

• 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. Sep 18 at 10:57