Is Digit-wise calculation possible? Suppose we have to do an intense calculation, like calculating $a^b$ for large $a$ and $b$. Then, instead of multiplying $a$ by itself $b$ times, could we just do some shortcut method with $a$ and $b$ which gives us the units digit of $a^{b}$, then another algorithm which gives the tens digit and hence, could we find the answer digit-by-digit?
I mean, could we have a function $f$ or any algorithm which takes three inputs: $a$, $b$, and $n$, such that $f(a,b,n)$ gives us the $n^{th}$ digit of $a^b$?
Similarly, could we have another algorithm, which takes inputs $a$ and $n$ and gives us the $n^{th}$ digit of $a!$, i.e. calculating factorials digit-wise?
Maybe, it's like a divisibility test where you have an algorithm to check whether $a$ is divisible by $b$ without actually dividing $a$ by $b$. Maybe, binary could be of some help in digit-wise calculation, because in binary, all the digits can have only two possible values.

I don't think that this is possible in general. But in some special cases we are lucky as in the following spectacular representation of $\pi$ (i.e. $a^b$ with $a=\pi$ and $b=1$) found by Bailey, Borwein and Plouffe in 1997. They got

\begin{align*}
\pi=\sum_{n=0}^\infty\frac{1}{16^n}\left(\frac{4}{8n+1}-\frac{2}{8n+4}-\frac{1}{8n+5}-\frac{1}{8n+6}\right)
\end{align*}

This rather simple formula was of particular interest to the three mathematicians due to the factor $\frac{1}{16^n}$ in the general term, as a factor of an arithmetically very simple function of $n$.
They were able to extract from this an algorithm (named BBP) to calculate the $d$-th digit of the expansion of $\pi$ individually in base $16$, and this even for very large $d$, without needing to know or calculate the digits preceding $d$. For example, the $10^{12}$th digit of $\pi$ in base $2$ is $1$.
