Suppose the series $s_k=\sum_{n=0}^{k} a_n$ is convergent with limit $a$. How to determine $N \in \mathbb N :|s_k-a| \le \epsilon$ for $n \ge N$ Suppose we have a convergent series $s_k=\sum_{n=0}^{k} a_n$ or sequence $\{a_n\}$ with limit $a$.
How can I determine $N \in \mathbb N$ such that $|s_k-a| \le \epsilon$ or $|a_n-a| \le \epsilon$ $ \   \ \forall \ n \ge N$.
This question has a lot of interest to me. Recently I proved the Leibniz' series is convergent with limit $\frac \pi 4$. I want to create a computer program that calculates $\pi$ from this series (it might be ineffective). However I know only the limit of the series, I don't know how many iterations to make before reaching $N \in \mathbb N$ such that the computation is within the required precision $\epsilon > 0$ for $n \ge N$ iterations.
 A: The Alternating Series Test says that for a sequence of positive numbers, $a_n$, that decreases monotonically to $0$,
$$
a=\sum_{k=1}^\infty(-1)^ka_k
$$
converges and the difference
$$
\left|a-\sum_{k=1}^n(-1)^ka_k\right|\le\left|a_{n+1}\right|
$$
So you just need to include terms in the Leibniz Series until the next term is smaller than the error you desire.

Note that the Leibniz Series, which is the evaluation of the Gregory Series at $x=1$ and converges extremely slowly, can be accelerated as in this question using Euler's Series Transformation to get the much more quickly converging series
$$
\frac{\pi}{2}=\sum_{k=0}^\infty\frac{k!}{(2k+1)!!}
$$
A: This Leibniz series has the property that its terms alternate in sign and their absolute values are monotone decreasing to zero. For such sequences, if $s_n$ is the sum of the first $n$ terms, then the sum $s$ of the series is always somewhere between $s_n$ and $s_{n+1}.$ So in making a program with tolerance say $0.01$ you just need to keep (careful) track of the partial sums and go until you get two in a row which are at most a certain distance apart to get the accuracy you want. 
[It is another thing to guarantee correct digits, as the values of the parial sums will not necessarily give intervals for which one knows the first $k$ digits, but that could be accommodated in the program by going until successive $s_n,s_{n+1}$ both lie in an interval where the digits can be predicted up to some point.]
