TITLE: What is the fastest/most efficient algorithm for estimating Euler's Constant $\gamma$?
QUESTION [56 upvotes]: What is the fastest algorithm for estimating Euler's Constant $\gamma \approx0.57721$?
Using the definition:
$$\lim_{n\to\infty} \sum_{x=1}^{n}\frac{1}{x}-\log n=\gamma$$
I finally get $2$ decimal places of accuracy when $n\geq180$.  The third correct decimal place only comes when $n \geq638$.  Clearly, this method is not very efficient (it can be expensive to compute $\log$).
What is the best method to use to numerically estimate $\gamma$ efficiently?

REPLY [2 votes]: No heavy machinery or special series manipulation required for this. Simple enough to do on a standard scientific calculator.
By applying the Euler-Maclaurin summation formula, one finds that
$$\lim_{b\to\infty}H_b-H_{n-1}-\ln(b)+\ln(n)=\frac1{2n}+\left(\sum_{j=1}^p\frac{B_{2j}}{2j\times n^{2j}}\right)+R_{n,p}$$
and thus, we may derive
$$\gamma=H_{n-1}-\ln(n)+\frac1{2n}+\left(\sum_{j=1}^p\frac{B_{2j}}{2j\times n^{2j}}\right)+R_{n,p}$$
where
$$H_n=\sum_{k=1}^n\frac1k$$
$$|R_{n,p}|\le\frac{2\zeta(2p)(2p-1)!}{(2\pi n)^{2p}}$$
where $\zeta$ is the Riemann zeta function. It suffices to use
$$\zeta(s)<\frac1{1-2^{1-s}}\left(1-\frac1{2^s}\right)$$
Or more simply,
$$\zeta(s)<2$$
both for $s\ge2$.
For example, with $n=5$ and $p=4$, we can approximate out $7$ places:
$$\gamma=H_4-\ln(5)+\frac1{10}+\frac1{300}-\frac1{75000}+\frac1{3937500}-\frac1{93750000}+R_{5,4}$$
$$\gamma\approx0.577215664+R_{5,4}$$
where
$$|R_{5,4}|<1.1\times10^{-8}$$