I am working on a $\pi$ estimation formula and I came up with the following series $$4\sum_{0}^{\infty}\frac{(1/5)^{2n+1}}{2n+1}-\sum_{0}^{\infty}\frac{(1/239)^{2n+1}}{2n+1}=\frac{\pi}{4}$$
How do I find how many terms are needed to give a value of $\pi$ accurate to $100$ decimal places? $b_{n+1}$ should be $\leq 1000001$ but how do I solve it, since I have two series?
As commented by achille hui, Machin' formula write $$\pi=16\sum_{n=0}^{\infty}\frac{(-1)^n(1/5)^{2n+1}}{2n+1}-4\sum_{n=0}^{\infty}\frac{(-1)^n(1/239)^{2n+1}}{2n+1}$$ that is to say $$\pi=\sum_{n=0}^{\infty}(-1)^n\frac{16(1/5)^{2n+1}-4(1/239)^{2n+1} }{2n+1}$$ Let $s_n$ be the sum of the first $n$ terms of this series. The series is alternating and and decreasing, so the $n^{\text{th}}$ remainder is such that $$| \pi-s_n | <\frac{16(1/5)^{2n+3}-4(1/239)^{2n+3} }{2n+3}=f_n$$ Generating a table of $\log_{10}(f_n)$ as a function of $n$ for $10 \leq n \leq 100$, a simple linear regression gives $$\log_{10}(f(n))=-1.40708 \,n-2.3825$$ So, if you need $k$ digits, you just need to solve $$-1.40708 n-2.3825=-k$$ that is to say $$n=-1.69323 + 0.710693 \, k$$
A more classical approximation is $$| \pi-s_n | \approx \frac 1 {25^n}$$ which will give $n=72$ for $100$ digits while the previous approximation would give $n=70$ (which is more accurate).
Rigorous calculations would show that $$f_{69}=3.16 \times 10^{-100}\qquad f_{70}=1.25 \times 10^{-101}\qquad f_{71}=4.92 \times 10^{-103}\qquad f_{72}=1.94 \times 10^{-104}$$
Edit
The second term is the expression being significantly smaller than the first one, we could considering that $$f_n \approx \frac{16(1/5)^{2n+3} }{2n+3}$$ and, so, we can have a good estimate of $n$ solving for $n$ equation$$\frac{16(1/5)^{2n+3} }{2n+3}=10^{-k}$$ the solution of which being $$2n+3=\frac{W\left(16 \times 10^k \times\log (5)\right)}{\log (5)}$$ where $W(z)$ is Lambert function. For large values of the argument, the Wikipedia page reports the approximation $$W(z)=L_1-L_2+\frac{L_2}{L_1}+\frac{L_2(L_2-2)}{2L_1^2}+\cdots$$ where $L_1=\log(z)$ and $L_2=\log(L_1)$.
For $k=100$, we then have $L_1\approx 233.507$, $L_2\approx 5.45321$ and applying the above (truncated formula), we find $n=69.3561$; so, $n=70$ again.
Notice that, if we truncate the expansion to the first term $W(z)\approx L_1$, we should get $n=-0.490805+0.715338 k$ which is very close to the regression result.