# 贝利-波尔温-普劳夫公式

$\pi = \sum_{k = 0}^{\infty}\left[ \frac{1}{16^k} \left( \frac{4}{8k + 1} - \frac{2}{8k + 4} - \frac{1}{8k + 5} - \frac{1}{8k + 6} \right) \right]$

$\alpha = \sum_{k = 0}^{\infty}\left[ \frac{1}{b^k} \frac{p(k)}{q(k)} \right]$

## 特例

$P(s,b,m,A) = \sum_{k=0}^{\infty}\left[ \frac{1}{b^k} \sum_{j=1}^{m}\frac{a_j}{(mk+j)^s} \right]$

### 已知的BBP式

\begin{align} \ln\frac{9}{10} & = - \frac{1}{10} - \frac{1}{200} - \frac{1}{3\ 000} - \frac{1}{40\ 000} - \frac{1}{500\ 000} - \cdots \\ & = - \sum_{k=1}^{\infty} \frac{1}{10^k \cdot k} = -\frac{1}{10} \sum_{k=0}^{\infty}\left[ \frac{1}{10^k} \left( \frac{1}{k+1} \right) \right] \\ & = -\frac{1}{10} P\left(1, 10, 1, (1) \right) \end{align}
\begin{align} \ln 2 & = \frac{1}{2} + \frac{1}{2 \cdot 2^2} + \frac{1}{3 \cdot 2^3} + \frac{1}{4 \cdot 2^4} + \frac{1}{5 \cdot 2^5} + \cdots \\ & = \sum_{k=1}^{\infty}\frac{1}{2^k \cdot k} = \frac{1}{2} \sum_{k=0}^{\infty}\left[ \frac{1}{2^k} \left( \frac{1}{k + 1} \right) \right] \\ & = \frac{1}{2} P\left( 1, 2, 1, (1) \right) \end{align}

\begin{align} \arctan\frac{1}{b} & = \frac{1}{b} - \frac{1}{b^3 3} + \frac{1}{b^5 5} - \frac{1}{b^7 7} + \frac{1}{b^9 9} + \cdots \\ & = \sum_{k=1}^{\infty}\left[ \frac{1}{b^{k}} \frac{ \sin\frac{k\pi}{2} }{k} \right] = \frac{1}{b} \sum_{k=0}^{\infty}\left[ \frac{1}{b^{4k}} \left( \frac{1}{4k+1} + \frac{-1}{4k+3} \right) \right] \\ & = \frac{1}{b} P\left( 1, b^4, 4, (1, 0, -1, 0) \right) \end{align}

### π的BBP公式

\begin{align}\pi & = \sum_{k = 0}^{\infty}\left[ \frac{1}{16^k} \left( \frac{4}{8k + 1} - \frac{2}{8k + 4} - \frac{1}{8k + 5} - \frac{1}{8k + 6} \right) \right] \\ & = P\left( 1, 16, 8, (4, 0, 0, -2, -1, -1, 0, 0) \right) \end{align}

$\pi = \sum_{k = 0}^{\infty}\left[ \frac{1}{16^k} \left( \frac{120k^2 + 151k + 47}{512k^4 + 1024k^3 + 712k^2 + 194k + 15} \right) \right]$

#### π的BBP位抽取算法

$\pi = 4 \sum_{k = 0}^{\infty} \frac{1}{(16^k)(8k+1)} - 2 \sum_{k = 0}^{\infty} \frac{1}{(16^k)(8k+4)} - \sum_{k = 0}^{\infty} \frac{1}{(16^k)(8k+5)} - \sum_{k = 0}^{\infty} \frac{1}{(16^k)(8k+6)}$

$\sum_{k = 0}^{\infty} \frac{1}{(16^k)(8k+1)} = \sum_{k = 0}^{n} \frac{1}{(16^k)(8k+1)} + \sum_{k = n + 1}^{\infty} \frac{1}{(16^k)(8k+1)}$

$\sum_{k = 0}^{\infty} \frac{16^{n-k}}{8k+1} = \sum_{k = 0}^{n} \frac{16^{n-k}}{8k+1} + \sum_{k = n + 1}^{\infty} \frac{16^{n-k}}{8k+1}$

$\sum_{k = 0}^{n} \frac{16^{n-k} \mod 8k+1}{8k+1} + \sum_{k = n + 1}^{\infty} \frac{16^{n-k}}{8k+1}$

$4 \Sigma_1 - 2 \Sigma_2 - \Sigma_3 - \Sigma_4. \,\!$

## 推广

D.J.布拉德赫斯特提出了一种BBP算法的泛化形式。[10]这种形式可以用于在接近线性时间和对数空间下求很多其他的常数。例如卡塔兰常数$\pi^3$$\log^32$阿培裏常数$\zeta(3)$（其中$\zeta(x)$黎曼ζ函數），$\pi^4$$\log^42$$\log^52$$\zeta (5)$，还有很多$\pi$$\log2$的不同幂次。这些结果主要是使用多重对数函数polylogarithm ladder）得到的。