[Math] Intuitive explanation of Bailey-Borwein-Plouffe $\pi$ extraction formula

algorithmspi

First, I should clarify, I'm not a mathematician. I don't study maths at college, so my knowledge of maths is sketchy at best.

I've been looking with interest at the Bailey-Borwein-Plouffe formula for calculating the nth digit of $\pi$, and I've been trying to work out how to code this in Visual Basic, with little success. I've been looking everywhere to try and understand the formula, but no one seems to provide simple or intuitive explanations – it seems rather niche, I guess. I'm also a little confused at the nature of the formula. I understand that it's a spigot algorithm, which apparently either calculates a sequence of decimals or extracts an nth-digit, but the Wikipedia page is confusing me, it seems to be describing both kinds of algorithm and I'm not sure what the direct formula does.

Would anyone be willing to try and explain the formula with a worked example, for example if $n = 4$? And am I right in thinking that using this formula correctly with $n$ as $4$ would return $5$, the fourth decimal digit?

I appreciate any help! The Wikipedia page is here

Best Answer

for intuition look at the way they use factorial base for $e = \sum_{n=1}^\infty \frac{1}{n!}$ here, $\pi$ is similar but less simple.