Question
How to prove the general form of the BBP(Bailey–Borwein–Plouffe) formula?
Prove this formula is always true, or find a counterexample $k$ that makes the formula invalid:
$$ π≟\sum_{n=0}^∞ \frac{1}{2^{4kn+4k+4 n+3}}\sum_{m=0}^{8k+8}\frac{ (1-i)^{m+1}+(1+i)^{m+1}-2^{m/2}\left((-1)^m+1\right)}{8kn+8k+8n-m+8},∀ k∈\mathbb{N} $$
Background
I discovered this formula while solving this problem:
Find pattern for BBP-type π formulas for order 28?
When $k = 0$, the original BBP formula is given, in which the coefficients are not simplified, and the rules are not obvious after simplification.
$$ π=\underset{n=0}{\overset{\infty }{\sum }}4^{-2 n-1} \left(\frac{16}{8 n+1}-\frac{8}{8 n+4}-\frac{4}{8 n+5}-\frac{4}{8 n+6}\right) $$
When $k = 1$, the following formula is given:
$$ π=\underset{n=0}{\overset{\infty }{\sum }}4^{-4 n-3} \left(\frac{256}{16 n+1}-\frac{128}{16 n+4}-\frac{64}{16 n+5}-\frac{64}{16 n+6}+\frac{16}{16 n+9}-\frac{8}{16 n+12}-\frac{4}{16 n+13}-\frac{4}{16 n+14}\right) $$
When $k = 2$, the following formula is given:
$$ π=\underset{n=0}{\overset{\infty }{\sum }}4^{-6 n-5} \left(\frac{4096}{24 n+1}-\frac{2048}{24 n+4}-\frac{1024}{24 n+5}-\frac{1024}{24 n+6}+\frac{256}{24 n+9}-\frac{128}{24 n+12}-\frac{64}{24 n+13}-\frac{64}{24 n+14}+\frac{16}{24 n+17}-\frac{8}{24 n+20}-\frac{4}{24 n+21}-\frac{4}{24 n+22}\right) $$
Numerical verification of higher order can also be passed.
A quick numerical verification can be done with the following Mathematica code.
ExtendBBP[k_] := Inactive[Sum][2^(-3 - 4k - 4n - 4k * n)*Sum[
((1-I)^(m+1)+(1+I)^(m+1)-2^(m/2)(1+(-1)^m))/
(8 + 8k - m + 8n + 8k * n),
{m, 0, 8 + 8k}],
{n, 0, Infinity}
];
N[Activate[ExtendBBP[0] - Pi], 200]
N[Activate[ExtendBBP[1] - Pi], 200]
N[Activate[ExtendBBP[2] - Pi], 200]
The proposed formula appears to be correct. The considered series can be written as \begin{align} S&=\sum_{n=0}^\infty \frac{1}{2^{4kn+4k+4 n+3}}\sum_{m=0}^{8k+8}\frac{ (1-i)^{m+1}+(1+i)^{m+1}-2^{m/2}\left((-1)^m+1\right)}{8kn+8k+8n-m+8}\\ &=\sum_{n=0}^\infty\sum_{m=0}^{2k'}\frac{1}{2^{(n+1)k'}}\,\frac{A_m}{(n+1)k'-m/2}\\ &=\sum_{m=0}^{2k'}A_m\sum_{n=1}^\infty\frac{1}{2^{nk'}}\,\frac1{nk'-m/2} \end{align} where \begin{align} k'&=4(k+1)\\ A_m&=(1-i)^{m+1}+(1+i)^{m+1}-2^{m/2}\left((-1)^m+1\right) \end{align} Considering the series \begin{equation} f(x)=\sum_{n=1}^\infty \frac{x^{nk'}}{nk'-m/2} \end{equation} one has \begin{align} \frac{d}{dx}\left[x^{-m/2}f(x)\right]&=\sum_{n=1}^\infty x^{nk'-m/2-1}\\ &=\frac{x^{k'-m/2-1}}{1-x^{k'}} \end{align} which gives \begin{equation} f(x)=x^{m/2}\int_0^x\frac{t^{k'-m/2-1}}{1-t^{k'}}\,dt \end{equation} Thus, with $x=1/2$, we have \begin{equation} \sum_{n=1}^\infty\frac{1}{2^{nk'}}\frac1{nk'-m/2}=2^{-m/2}\int_0^{1/2}\frac{t^{k'-m/2-1}}{1-t^{k'}}\,dt \end{equation} After inversion of summation and integral, the series reads \begin{equation} S=\int_0^{1/2}\frac{t^{k'-1}}{1-t^{k'}}\,dt\sum_{m=0}^{2k'}A_m \left(2t\right)^{-m/2} \end{equation}
To evaluate the $m-$summation, $A_m$ is expressed as \begin{align} A_m&=(1-i)^{m+1}+(1+i)^{m+1}-2^{m/2}\left((-1)^m+1\right)\\ &=\sum_{p=0}^{m+1}\binom{m+1}p i^p\left( (-1)^p+1 \right)-2^{m/2}\left((-1)^m+1\right) \end{align} which gives \begin{align} A_{2r}&=\sum_{p=0}^{2r+1}\binom{2r+1}p i^p\left( (-1)^p+1 \right)-2^{r+1}\\ &=2\sum_{s=0}^{r}\binom{2r+1}{2s} (-1)^s-2^{r+1}\\ &=-2^{r+1}\left( 1+\sin\left( \frac{r\pi}{2} \right)-\cos\left( \frac{r\pi}{2} \right)\right)\\ A_{2r-1}&=\sum_{p=0}^{2r}\binom{2r}p i^p\left( (-1)^p+1 \right)\\ &=2\sum_{s=0}^{r}\binom{2r}{2s} (-1)^s\\ &=2^{r+1}\cos\left( \frac{r\pi}{2} \right) \end{align} The evaluation of the alternating binomial sums was made using this question. These expressions are discussed for different values of $r\mod4$: \begin{align} A_{8q}=A_{8r+6}&=0\\ A_{8q+2}&=-2^{4q+3}\\ A_{8q+4}&=-2^{4q+4}\\ A_{8q+1}=A_{8q+5}&=0\\ A_{8q+3}&=-2^{4q+3}\\ A_{8q+7}&=2^{4q+5} \end{align}
Accordingly, the $m-$summation is decomposed : \begin{align} \sum_{m=0}^{2k'}A_m \left(2t\right)^{-m/2}&=\sum_{m=0}^{8(k+1)}A_m \left(2t\right)^{-m/2}\\ &=A_{8(k+1)}t^{-4(k+1)}+\sum_{j=0}^7\sum_{q=0}^{k}A_{8q+j}\left(2t\right)^{-4q-j/2}\\ &= \sum_{q=0}^{k}\left[A_{8q+2} \left(2t\right)^{-4q-1} +A_{8q+3} \left(2t\right)^{-4q-3/2} +A_{8q+4} \left(2t\right)^{-4q-2} +A_{8q+7} \left(2t\right)^{-4q-7/2} \right]\\ &=\sum_{q=0}^{k}\left[-2^{2} t^{-4q-1} -2^{3/2} t^{-4q-3/2} -2^{2} t^{-4q-2} +2^{3/2}t^{-4q-7/2} \right]\\ &=\frac{-2 t^{11/2} \sqrt{2}+2 \sqrt{2}\, t^{9/2}-4 t^{6}+2 \sqrt{2}\, t^{-4 k +3/2}-2 \sqrt{2}\, t^{-4 k +1/2}+4 t^{2-4 k}}{t^{4} \left(t -1\right) \left(t^{2}+1\right)}\\ &=\frac{2 \left(t^{4}-t^{-4 k}\right) \left(2 t^{2}-\sqrt{2}\, \sqrt{t}\, \left(1-t \right)\right)}{t^{4} \left(1-t \right) \left(t^{2}+1\right)} \end{align} (helped by a CAS!). One obtains thus \begin{align} S&=\int_0^{1/2}\frac{t^{4k+3}}{1-t^{4k+4}}\frac{2 \left(t^{4}-t^{-4 k}\right) \left(2 t^{2}-\sqrt{2}\, \sqrt{t}\, \left(1-t \right)\right)}{t^{4} \left(1-t \right) \left(t^{2}+1\right)}\,dt\\ &=\int_0^{1/2}\frac{2\sqrt2 \left(1-t\right) -4 t^{3/2}}{\sqrt{t}\, \left(t^{2}+1\right) \left(1-t\right)}\,dt \end{align} Interestingly, this integral does not depend on $k$. To evaluate this integral, we change first $t=(1-v^2)/2$ \begin{align} S&=\int_0^{1/2}\frac{2\sqrt2 \left(1-t\right) -4 t^{3/2}}{\sqrt{t}\, \left(t^{2}+1\right) \left(1-t\right)}\,dt\\ &=-16\int_0^1\frac{v\,dv}{(1+v^2)(v^2-2v-1)}\\ &=4\int_0^1\frac{dv}{1+v^2}+4\int_0^1\frac{v\,dv}{1+v^2}-4\int_0^1\frac{v-1}{v^2-2v-1}\,dv \end{align} The second integral of the latter expression is equal to the third one, as changing $v=\sqrt z$ in the second gives and $v=1-\sqrt{1-w^2}$ \begin{align} \int_0^1\frac{v\,dv}{1+v^2}&=\frac12\int_0^1\frac{dz}{1+z}\\ \int_0^1\frac{v-1}{v^2-2v-1}\,dv&=\frac12\int_0^1\frac{dw}{1+w} \end{align} Finally, \begin{align} S&=4\int_0^1\frac{dv}{1+v^2}\\ &=\pi \end{align} as expected.