# Why is Mathematica saying this sequence tends to $0$?

I am a complete novice in Mathematica so please bear with me. I am trying to graph a sequence that converges to $$\pi$$ but after $$27$$ iterations Mathematica just goes crazy and I am not sure why. I got the sequence by first noticing $$2^n\sin\frac{\pi}{2^n} \to \pi$$ and then just using the double angle formula for cosine. Could some one point out why after 28 iterations Mathematica spits out 0? Also what would be a reasonable way to find how fast by approach converges to pi? Using mathematica? I used Discrete plot but it is hard do see what the error is. I also do not know which tag to use to i apologize if I got it wrong.

Code:

a[n_] := a[n] = Sqrt[2 + a[n - 1]];
a[1] = Sqrt[2];

DiscretePlot[2^n  Sqrt[1 - (2 + a[n - 2])/4], {n, 0, 30}]

• a[n] convergs to 2. So (2+a[n])/4 is converging to 1. So Sqrt[1-(2+a[n])/4] is converging to Sqrt[1-1]=0. – bill s Oct 1 '20 at 15:07
• Change the plotting range DiscretePlot[2^n Sqrt[1 - (2 + a[n - 2])/4], {n, 3, 30}] because a[i] is only defined for ì>=1 – Ulrich Neumann Oct 1 '20 at 15:09
• @bills That is correct, but then how do I increase accuracy? Should I move the $2^n$ into the square root? – 2132123 Oct 1 '20 at 15:15
• @UlrichNeumann You are right, but that did not fix the issue – 2132123 Oct 1 '20 at 15:36
• Simply specify e.g.; WorkingPrecision -> 100 – Daniel Huber Oct 1 '20 at 15:54