Slightly inspired by this question:
I have noticed that in the representation of powers of $9$ on base $10$, each digit repeats periodically as a function of the exponent.
I assume that the same behavior can be observed in the representation of powers of $k$ on base $k+1$, but for the sake of simplicity, I will focus on the specific case of $k=9$.
A few examples:
The period of the $1$st digit is $2$:
- $n\equiv0\pmod{2}\implies9^n\equiv1\pmod{10}$
- $n\equiv1\pmod{2}\implies9^n\equiv9\pmod{10}$
The period of the $2$nd digit is $10$:
- $n\equiv0\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv0\pmod{10}$
- $n\equiv1\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv0\pmod{10}$
- $n\equiv2\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv8\pmod{10}$
- $n\equiv3\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv2\pmod{10}$
- $n\equiv4\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv6\pmod{10}$
- $n\equiv5\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv4\pmod{10}$
- $n\equiv6\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv4\pmod{10}$
- $n\equiv7\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv6\pmod{10}$
- $n\equiv8\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv2\pmod{10}$
- $n\equiv9\pmod{10}\implies\lfloor\frac{9^n}{10}\rfloor\equiv8\pmod{10}$
The period of the $3$rd digit is $50$...
The period of the $4$th digit is $250$...
Let $Dm_n=\lfloor\frac{9^n}{10^m}\rfloor\bmod{10}$ denote the $m$th digit of $9^n$.
Let $p(m)=2\cdot5^m$ denote the period of the sequence $Dm$.
Please note that I am using $m$ as a $0$-based index in the above notations.
Is there any efficient way to determine the values of $Dm_0,\dots,Dm_{p(m)-1}$?
If there is one, then I believe that it will allow us to easily compute the middle digit of $9^{50000}$, thus essentially answer the inspiring question linked above.
Thanks