I would like to evaluate
$$s = 1 - \frac{1}{2} - \frac{1}{3} + \frac{1}{4} - \frac{1}{5} + \frac{1}{6}+\frac{1}{7}-\frac{1}{8} - ... + \frac{(-1)^{\textrm{binary digit sum}(n-1)}}{n} + ... $$
where the signs follow the Thue-Morse sequence. When I try to evaluate
Sum[ (-1)^Total[ IntegerDigits[ n - 1, 2]]/n, {n, 1, ∞}]
using Mathematica 7 I get
Log[2]
This is incorrect. $$\log( 2) = \sum_{n=1}^\infty \frac{(-1)^{n-1}}{n} \approx 0.693147$$ but $$s \approx 0.39876108810841881241$$ I checked this using C# and finite sums within Mathematica. This value is not in the inverse symbolic calculator, but since that is incomplete I still have some hope for an analytic summation.
The difference between these series can be expressed as a sum of positive terms $$\frac{2}{3\times 4} + \frac{2}{5\times 6} + \frac{2}{9\times 10} + \frac{2}{15\times 16}+\ldots+\frac{2}{n \times (n+1)}+ \ldots$$ where the sum is over all odd $n$ with even binary digit sum, so it is definitely the case that $s \lt \log( 2).$
I also tried
Sum[ (-1)^Total[ IntegerDigits[ n - 1, 2]]/n, { n, 1, ∞, 2}]
which equals $\frac{3}{2}s \approx 0.59814163216262821861$, but which instead evaluates to
Sum::div: Sum does not converge Sum[ (-1)^(1 + n)/n, { n, 1, ∞, 2}]
So, is this a known bug?
What sorts of related sums are affected?
Is there a way to get the right answer from Mathematica?
Sum[(-1)^Total[IntegerDigits[n - 1, 2]]/n, {n, 1, m}]
also incorrect ? $\endgroup$IntegerDigits[n - 1, 2]
returns unevaluated, andTotal
thereof then givesn+1
. Not wrong, but also not what is wanted. To forestall this one might rewrite the summand as a "black box" function that only evaluates on explicit integer input, e.g.f[n_Integer] := (-1)^Total[IntegerDigits[n - 1, 2]]/n
. Using this the sum returns unevaluated (no surprise there). $\endgroup$GeneratingFunction
won't work because the recurrence for the Thue Morse sequence (and thus also the summand here) is not simple enough forGeneratingFunction
andDifferenceRoot
to handle. Otherwise we could construct a whole power series / generating function and then evaluate at $x=1$. $\endgroup$