Proving a curious formula of $\pi$?

I have recently come across this statement without proof.

$$ \pi = 128 \arctan\frac{1}{40} -4\arctan\frac{1}{239} -16\arctan\frac{1}{515} -32\arctan\frac{1}{4030} -64\arctan\frac{1}{32060}$$

I'd put down my approach but, to be frank, I've gotten nowhere with this. How to go about this ?


Use the fact that $\arctan(1/a)$ is the argument of $a+i$, and that the arguments of complex numbers add up when you multiply them.

According to WolframAlpha, we have $$ \begin{aligned} &\frac{(40+i)^{128}}{(239+i)^4 (515+i)^{16} (4030+i)^{32} (32060+i)^{64}} = \\ &-1 / 37403944359352749280528518983232679702 \\ & 01985315749502348525466597837636105197 \\ & 87830439618227322115549670041854205583 \\ & 78215314658650047572142913167759891935 \\ & 23573829633433227264657819301199042671 \\ & 95356826263444502459300305177919563475 \\ & 022474784673838736016384 . \end{aligned} $$ Since this is a negative number, it has argument $\pi$, and this must agree with your sum, except that they might differ by $2\pi n$ for some integer $n$, since arguments are not uniquely defined. But just by numerical evaluation one should be convinced that your sum is a least close enough to $\pi$ to rule out all the options except $n=0$. Q.E.D.

(There is probably some better argument which estimates the terms in your sum without resorting to numerics, but I'm a bit lazy here...)