3

I was wondering what are the typical mathematical tools (theorems, proof techniques etc.) one might use to answer questions about the "central" digits of large integer powers, in various bases. I define "central" fuzzily as "sufficiently far away from the first and the last". For example, questions like "what is the $2017^{th}$ digit from the right (or from the left) of $2017^{2017}$?".

I do not care only about tools that allow me to precisely determine them, but also about ones allowing me to talk about more general properties, e.g. prove (or disprove) that the $2017^{th}$ digit from the right of any sequence of $2017$ consecutive powers of $2017$ takes every value from $0$ to $9$ at least once. I'd be happy to hear about impossibility/hardness results too, stuff like "in such and such a condition, determining whether any member of this set of digits is even or odd in NP-complete".

I understand this is a very broad question, but I hope it's ok to ask it. I'd really just like some pointers, the more the better!

Watson
  • 23,793

1 Answers1

1

The rightmost $m$ digits of $x$ correspond to $x \mod 10^m$. (Yes, I'm going to use "mod $10^m$" as a function rather than a relation: apologies to number theorists). So the $m$'th digit is $10^{1-m}((x \mod 10^m) - (x \mod 10^{m-1}))$.

Powers mod $10^m$ can be efficiently computed by repeated squaring. Maple does this automatically if you use ... &^ ... mod ... instead of ... ^ ... mod .... Thus

10^(-2016)*((2017 &^ 2017 mod 10^2017) - (2017 &^ 2017 mod 10^2016));

almost immediately returns $0$. Computing the $m$-th digit of $a^p$ requires on the order of $\log(p)$ arithmetical operations on $m$-digit numbers.

Robert Israel
  • 448,999