Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
Is the partial sum Sum[(-1)^Total[IntegerDigits[n - 1, 2]]/n, {n, 1, m}] also incorrect ? –  b.gatessucks Apr 1 at 13:10
    
@b.gatessucks: The partial sums seem to be correct. They agree numerically with computations in C#. –  Douglas Zare Apr 1 at 13:12
    
Do you agree on the output of Total[IntegerDigits[n - 1, 2]] ? –  b.gatessucks Apr 1 at 13:36
6  
The result obtained arises from the fact that IntegerDigits[n - 1, 2] returns unevaluated, and Total thereof then gives n+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). –  Daniel Lichtblau Apr 1 at 14:24
1  
@DouglasZare I did not mean numerical calculations were not welcome. I guessed you would underline the problem in a bit clearer setting. Anyway I upvoted your question and I think it deserves more upvotes. –  Artes Apr 1 at 16:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.