While trying to answer this Math.SE question, I believe I found several bugs in Mathematica and Alpha relating to the Thue-Morse sequence.

As a quick reminder, the $n^{\rm th}$ element of the Thue-Morse sequence (denoted here by $t_n$) is $1$ if the sum of its binary digits contains an odd number of $1$s, $0$ otherwise.

In essence, I typed the function $$ \zeta_{TM}(s) = \sum_{n\geq0} \frac{t_{n}}{(n+1)^s} $$ in Alpha, which surprisingly gave $$ \zeta_{TM}(s) = 2^{-s}\zeta(s), $$ where $\zeta(s)$ is the Riemann Zeta function. This is obviously wrong as the LHS does not converge to the RHS for any $s>1$. Upon further inspection, it appears that Alpha translated ThueMorse[n] to Mod[Plus @@ IntegerDigits[n, 2], 2], which is perfectly fine as this is the definition of the Thue-Morse sequence.

Turning to Mathematica to resolve this conundrum, I found that it too makes the same mistake. Inputting

Sum[Mod[Plus @@ IntegerDigits[n, 2], 2]/(n + 1)^s, {n, 0, Infinity}]


2^-s Zeta[s]

which again is obviously wrong. Taking the example of $s=3$ and computing the partial sums up to a positive integer $m$ and dividing them with $2^{-s}\zeta(s)$ clearly shows that they diverge:

s = 3
Table[N[Sum[Mod[Plus @@ IntegerDigits[n, 2], 2]/(n + 1)^s, {n, 0, 10^m}]]/(2^{-s}*Zeta[s]), {m, 1, 5}]


{{1.15377}, {1.16799}, {1.16814}, {1.16814}, {1.16814}}

which most certainly does not converge to $1$.

So what is going on here? Is this truly a bug in Alpha and Mathematica, or am I missing something very obvious?

For info, I am using Mathematica 11.

  • 1
    $\begingroup$ Please do not use the bugs tag when posting new questions. See the tag description for why. $\endgroup$ – Szabolcs May 18 at 7:39

The problem is the following:

Mod[Plus @@ IntegerDigits[n, 2], 2]
Mod[2 + n, 2]

This happens because IntegerDigits stays unevaluated for non integer inputs:

IntegerDigits[n, 2]
IntegerDigits[n, 2]

Note that this sum remains unevaluated:

Sum[ThueMorse[n]/(n + 1)^s, {n, 0, Infinity}]
Sum[ThueMorse[n]/(n + 1)^s, {n, 0, Infinity}]

Ideally Alpha should be using the System symbol rather than its own macro. The results here are just wrong for the reasons mentioned above. I'll file feedback to make sure this gets fixed.

  • $\begingroup$ Great, thank you! $\endgroup$ – Klangen May 21 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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