<s>[INST] Working out digits of Pi. I have always wondered how the digits of π are calculated. How do they do it?

Thanks.
 [/INST] From one of my favorite mathematicians,
$$
\frac{1}{\pi}=\frac{2\sqrt{2}}{9801}\sum_{k \ge 0} \frac{(4n)!(1103+26390n)}{(n!)^4396^{4n}}.
$$
Looking here, we see some many formulae. Some of particular interest are:
$$
\pi=\sum_{k \ge 0}\frac{3^k-1}{4^k}\zeta(k+1),\quad \zeta(s)=\sum_{k\ge 0}k^{-s}.
$$
$$
\frac{1}{6}\pi^2=\sum_{k \ge 1}\frac{1}{k^2} \quad \text{via the Basel problem}.
$$
$$
\pi =\frac{3}{4}\sqrt{3}+24\int_0^{\frac{1}{4}}\sqrt{x-x^2}dx.
$$
$$
\frac{\pi}{5\sqrt{\phi+2}}=\frac{1}{2}\sum_{k \ge 0}\frac{(k!)^2}{\phi^{2k+1}(2k+1)!},\quad \text{where } \phi \text{ is the golden ratio.}
$$
$$
\pi=\frac{22}{7}-\int_{0}^{1}\frac{x^4(1-x)^4}{1+x^2}dx.
$$
$$
\pi=4\sum_{1 \le k \le n}\frac{(-1)^{j+1}}{2j-1}+\frac{(-1)^n}{(2n-1)!}\sum_{i \ge 0}\frac{1}{16^i}\left( \frac{8}{(8i+1)_{2n}}-\frac{4}{(8i+3)_{2n}}-\frac{4}{(8i+4)_{2n}}-\frac{2}{(8i+5)_{2n}}+\frac{1}{(8i+7)_{2n}}+\frac{1}{(8i+8)_{2n}} \right),\quad \text{where } n \in \mathbb{Z}_{>0}, \text{ and } (x)_{n} \text{ represents the Pochhammer symbol.}
$$
$$
\pi = 2\left[\prod_{n \ge 0}\left(1+\frac{\sin\left(\frac{1}{2}p_n\right)}{p_n}\right) \right]^{-1},\quad p_n \text{ is the } n\text{th} \text{ prime number}.
$$
$$
\frac{2}{\pi}=\sqrt{\frac{1}{2}}\sqrt{\frac{1}{2}+\frac{1}{2}\sqrt{\frac{1}{2}}}\sqrt{\frac{1}{2}+ \frac{1}{2}\sqrt{\frac{1}{2}+\frac{1}{2}\sqrt{\frac{1}{2}}}}\cdots
$$
$$
\frac{\pi}{2}=\prod_{n \ge 1}\frac{(2n)^2}{(2n-1)(2n+1)}.
$$
</s>