For the following question, all what is needed to know about Graham's number is that it is a power tower with many many many $3's$
Consider the following pseudocode :
input n
Start with $s=1$ and $p=7$ (the last digit of $3^3$)
Repeat
$s=s+1$
$p=3^p$ modulo $10^s$
Until $s=n$
output p
Questions :
- Does this algorithm return the $n$ last digits of Graham's number ?
- If I take another base and $p$ happens to get smaller than $s$. Do I have to add $\lambda(10^s)$ to $p$ ?
- Can I calculate the $n$ last digits of Graham's number (or another tetrated number) easier ?