OFFSET
0,1
LINKS
Melissa Larson, Verifying and discovering BBP-type formulas, 2008.
Wikipedia, Bailey-Borwein-Plouffe formula.
FORMULA
Equals Integral_{x=0..1} arctan(x)/(x*(1 + x)) dx.
Equals Im(Polylog(2, (1 + i)/2)).
Equals Catalan - Pi * log(2) / 8.
Equals (zeta(2, 1/4) - Pi * (Pi + log(2))) / 8.
EXAMPLE
0.64376733288926874874201740265268236735682641173551134747577...
MAPLE
Im(polylog(2, (1 + I)/2)): evalf(%, 88);
MATHEMATICA
First[RealDigits[Catalan - Pi * Log[2] / 8, 10, 87]]
PROG
(Python) # Use a few guard digits when computing.
# BBP formula (1 / 16) P(2, 16, 8, (8, 8, 4, 0, -2, -2, -1, 0))
from decimal import Decimal as dec, getcontext
def BBPCatSer(n: int) -> dec:
getcontext().prec = n
s = dec(0); f = dec(1); g = dec(16)
for k in range(n):
ek = dec(8 * k)
s += f * ( dec(8) / (ek + 1) ** 2 + dec(8) / (ek + 2) ** 2
+ dec(4) / (ek + 3) ** 2 - dec(2) / (ek + 5) ** 2
- dec(2) / (ek + 6) ** 2 - dec(1) / (ek + 7) ** 2 )
f /= g
return s / g
print(BBPCatSer(200))
CROSSREFS
KEYWORD
nonn,cons
AUTHOR
Peter Luschny, Nov 03 2023
STATUS
approved