Bug introduced in 4.2 or 5.0, persisting through 13.0.0.

Note: this is a repost of my OP on math.SE. I am posting it here because multiple users with different Mathematica versions have given me the feedback that they also have the same incorrect behaviour while evaluating the sum below. The following paragraphs are basically a copy paste of the OP, for those who don't want to click.

In proving the irrationality of $\displaystyle \zeta(3)=\sum_{n\geq1}\frac{1}{n^3}$, Apéry introduced the accelerated series

$$ \zeta(3)=\frac{5}{2} \sum_{k=1}^{\infty}{\frac{ (-1)^{k-1}} {\binom {2k}{k}k^{3}}}. $$

A crucial ingredient of his proof of the above identity is the well-known equality $$ \sum_{k=1}^{n-1} \frac{(-1)^{k-1}(k-1)!^2}{(n^2-1^2)\ldots(n^2-k^2)}=\frac{1}{n^2}-\frac{2(-1)^{n-1}}{n^2 \binom{2n}{n}}. $$ (note that an excellent overview of his proof can be found in Van der Poorten's "A Proof that Euler Missed...".)

I was trying to verify the above equality numerically, in Wolfram Mathematica. However, when asking to evaluate the LHS, Mathematica surprisingly gave:


This is obviously false, as quick numerical verification reveals.

This was the simple Mathematica instruction I ran:

N[Sum[((-1)^(k - 1) ((k - 1)!)^2)/(Product[(n^2 - j^2), {j, 1, k}]), {k, 1, n - 1}]]

Note that Wolfram Alpha gives the same incorrect evaluation for the same expression, as can be seen here.

So what am I doing wrong? Clearly, the instruction itself is correct (click the Alpha link to see this). So is the Wolfram engine making an elementary mistake, or am I doing so?

  • $\begingroup$ @MarcoB OK thank you. $\endgroup$
    – Klangen
    Dec 8, 2020 at 22:41
  • 4
    $\begingroup$ Klangen I am unfamiliar with the formula itself, but numerical test validation agrees with your result over a wide range of n. I think you are right to say that it is a bug. I would encourage you to report it to Wolfram Support. $\endgroup$
    – MarcoB
    Dec 8, 2020 at 22:50
  • 1
    $\begingroup$ Another very old bug. v4.1 cannot solve it: i.stack.imgur.com/eQrYS.png v5.0 gives (Csc[(n*Pi)/2]*Sec[(n*Pi)/2]*(-Pi + n^2*Pi + n*HypergeometricPFQ[{1, 1, 1}, {2 - n, 2 + n}, 1]*Sin[n*Pi]))/(2*(-1 + n)*n*(1 + n)), whose limitation when n is an integer seems to be 1/n^2: i.stack.imgur.com/euQjw.png $\endgroup$
    – xzczd
    Dec 9, 2020 at 8:20
  • 1
    $\begingroup$ @Andreas I find that weird since none of the terms equal $0$ ($k$ runs at most up to $n-1$) $\endgroup$
    – Klangen
    Dec 9, 2020 at 20:05
  • 1
    $\begingroup$ there seems to be a problem there: The product evaluates correctly to an expression with Pochhammer terms. But if you compare for instance n = 4; Table[ Pochhammer[1 - n, k], {k, 1, n - 1}] with n = 4; Table[Gamma[1 + k - n]/Gamma[1 - n], {k, 1, n - 1}] (obtained by applying FunctionExpand on the Pochhammer) the results are different. $\endgroup$
    – Andreas
    Dec 9, 2020 at 20:31

2 Answers 2


To illustrate this issue, the difference between 1/n^2 and the result of the Sum becomes very small as n gets larger. Here for n = 2 to 20.

Table[N[1/n^2  - 
   Sum[((-1)^(k - 1) ((k - 1)!)^2)/(Product[(n^2 - j^2), {j, 1, 
        k}]), {k, 1, n - 1}], Infinity], {n, 2, 20}]

enter image description here

  • $\begingroup$ I don't think this answers the question. $\endgroup$ Dec 11, 2020 at 12:27

Since the symbolic sum fails, only evaluate the sum for numeric values of n

sum[n_Integer?Positive] := 
 sum[n] = Sum[(-1)^(k - 1) ((k - 1)!)^2/Product[n^2 - m^2, {m, 1, k}], {k, 1, 
    n - 1}]

f = 1/n^2 - 2 (-1)^(n - 1)/(n^2 Binomial[2 n, n]);

And @@ Table[f == sum[n], {n, 1, 200}]

(* True *)
  • $\begingroup$ I don't think this answers the question, as it is. I suggest adding a big "## yes, it's a bug" header, at least. $\endgroup$ Dec 11, 2020 at 12:27

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.