# Trouble with the numerical evaluation of a series

The series is $$\;S=\displaystyle{\sum_{n=0}^\infty 2^{-n+\sin(n\pi/5)}}$$.

Mathematica doesn’t find a closed form for Sum[2^(-n + Sin[n Pi/5]), {n, 0, Infinity}], so I tried both:

N[Sum[2^(-n + Sin[n Pi/5]), {n, 0, Infinity}], 100] NSum[2^(-n + Sin[n Pi/5]), {n, 0, Infinity}, WorkingPrecision -> 100] 

They return the same result:

2.621953360503001622580428627210775515701951638633391919349668089988053230383633286891962065806603221 

However, as I discovered later, this result is wrong. Indeed, the series is not difficult to evaluate, thanks to the periodicity of $$\sin(n\pi/5)$$:

$$S=\left(\sum_{n=0}^\infty2^{-10n}\right)\left(\sum_{n=0}^92^{-n+\sin(n\pi/5)}\right)=\frac{1}{1-2^{-10}}\sum_{n=0}^92^{-n+\sin(n\pi/5)}$$

And N[1/(1 - 2^-10) Sum[2^(-n + Sin[n Pi/5]), {n, 0, 9}], 100] yields:

2.621953365022156800044269458734842788555304465923212022625632939238430813027293562013936284925892294 

So the initial sum only had 9 correct digits. It’s so bad that I am almost certain I am missing an important option, but I have no idea which (I tried playing with AccuracyGoal and PrecisionGoal, but it led me nowhere so far).

Any idea to get the numerical answer directly?

The same method as above can be used to evaluate $$\displaystyle{\sum_{n=0}^\infty 2^{-n+(-1)^n}}$$, and the sum is $$3$$, however, Mathematica fails with a message that starts with NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections. So again I must be missing somthing important. The failure occurs with:

N[Sum[2^(-n + (-1)^n), {n, 0, Infinity}], 100] 

My guess would be that it fails for this one because the correct answer is an integer, and thus it’s impossible to give even a single correct digit since the sum could be 2.99999… or 3, but I’m not sure what really happens here, nor how to deal with this.

I’m not entirely new to Mathematica, but I have always found that numerical computations are difficult to handle with it. If someone can point to a good tutorial on this kind of problem or similar ones with NIntegrate, it would be really helpful!