Predicting \(2^n\) (in base 10)



I work towards a formula to predict \(2^n\) for any \(n\). I don’t expect to complete it, but I have found the last four digits for any \(n \in \mathbb{N}\).

Update: I have found a relationship between the sequences that in theory should allow the calculation of any digit of \(2^n\) by storing only \(4\) digits...

Update II: The sequence fails for some numbers as it cycles in a non prime manner, numbers would either need to be stored, or a prime cycling sequence discovered which seems unlikely.

Statement of Problem

I would like to be able to predict any given digit of then number \(2^n\) for any \(n\). The sequence begins \[2,4,8,16,32,64,128,256,512,...\]

We can see the end digit here will always be predictable by a sequence of period \(4\), which is \(2,4,8,6...\). This is nice and simple.

Assuming, there exists such a sequence for any given digit, we may attempt to find them and thier relationships with each other and the original sequence, apart from the obvious \(2^n \; \mathrm{mod} \; 10^k\), for the \(k^{th}\) digit.

Finding the Sequences

So categorising the sequences \(D_k\) for the \(k^{th}\)-least significant digit, we have \[D_0 = 2,4,8,6... \;\; p:4 \;\; OEIS:A000689 \\ \\ D_1 = 0|0,0,1,3,6,2,5,1,2,4,9,9,8,6,3,7,4,8,7,5...\;\; p:20 \;\; OEIS:A160590 \\ \\ D_2 = 0,0|0,0,0,0,1,2,5,0,0,0,1,3,7,5,0,1,2,5,1,3,6,2,4,8,7,4,9,8,6,2,5,1,3,7,\\ 4,9,8,7,5,1,2,4,8,6,3,6,3,6,2,4,9,9,9,9,8,7,4,9,9,9,8,6,2,4,9,8,7,4,8,6, \\ 3,7,5,1,2,5,0,1,3,7,4,8,6,2,5,0,1,2,4,8,7,5,1,3,6,3,6,3,7,5... \;\;p:100 \;\; OEIS:-- \\ \\ D_3 = 0,0,0|... \;\; p:500 \;\; OEIS:-- \\ \\\]

Where the \(|\) denotes the starting point of the recuring sequence. We can see that the sequence \(D_k\) is prepended by \(k\) zeroes before the sequence with periodicity \(4\cdot5^k\) occurs.

We may describe the first sequence by: \[P*v[*(((n+3) mod 4)+1)]=D_0 \\ \mathrm{where} \\ Pv=D_0=\begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix}\begin{bmatrix} 2\\4\\6\\8 \end{bmatrix}=\begin{bmatrix} 2\\4\\8\\6 \end{bmatrix}\]

Asessing the occurence of each number within \(D_1\), apart from the prepended \(0\), we have each digit \(d\in[0,9]\) occurring exactly twice. Therefore we may express \[0,0,1,3,6,2,5,1,2,4,9,9,8,6,3,7,4,8,7,5... \\ Pv=D_1 \\ \begin{bmatrix} 1&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0&1&0&0&0&0&0&0&0&0&0\\ 0&1&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&1&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&1&0&0&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&1&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&1&0&0&0&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0&0&1&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0&0&0&1&0&0&0&0&0&0&0\\ 0&0&0&0&1&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&1&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&1\\ 0&0&0&0&0&0&0&0&1&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&1&0&0&0\\ 0&0&0&0&0&0&0&0&0&0&0&0&0&1&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&1&0&0&0&0&0&0&0&0&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&1&0&0&0&0&0\\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&1&0\\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&1&0&0\\ 0&0&0&0&0&0&0&0&0&0&0&0&0&0&0&1&0&0&0&0 \end{bmatrix} \begin{bmatrix} 0\\1\\2\\3\\4\\5\\6\\7\\8\\9\\0\\1\\2\\3\\4\\5\\6\\7\\8\\9 \end{bmatrix}\]

Also anaylysing the sequences take \(D_1\) we have \[0,0,1,3,6,2,5,1,2,4,\;\;\\ 9,9,8,6,3,7,4,8,7,5...\]

Where it can be seen that summing the pairs of numbers downwards makes \(9\) for each pair. We can denote the sequence \(S^{*9*}=9,9,8,6,3,7,4,8,7,5\) the \(9^{th}s\) conjugate of the sequence \(S=0,0,1,3,6,2,5,1,2,4\), such that the sum of the two is \(9,9,9,9,9,9,9,9,9,9\)

In this notation
\(D_0=S_0S_0^{*10*}\), for \(S_0=2,4\).
\(D_1=S_1S_1^{*9*}\), for \(S_1=0,0,1,3,6,2,5,1,2,4\).
\(D_2=S_2S_2^{*9*}\), for \(S_2=0,0,0,0,1,2,5,0,0,0,1,3,7,5,0,1,2,5,1,3,6,2,4,8,7,4,9,8,6,2,5,1,3,7,4,9,8,7,5,1,2,4,8,6,3,6,3,6,2,4\).
Which may ultimately halve the storage space for a ’lookup-method’, for quoting digits of a given \(2^n\). It can be seen that all of the sequences tested end in \(2,4\) and begin with \(2n\) zero terms.


Thus we may set up the following rules. \[\begin{array}{|c|c|} \hline If\;True & Last \; Digit \\ \hline n\;mod\;4=1 & 2 \\ n\;mod\;4=2 & 4 \\ n\;mod\;4=3 & 8 \\ n\;mod\;4=4 & 6 \\ \hline \end{array}\]

\[\begin{array}{|c|c|} \hline If\;True & 2^{nd} \; to \; Last \; Digit \\ \hline n-1\;mod\;20=k & D_1(k) \\ \hline \end{array}\]

In general, for any digit of \(2^n\), which is \(p\) places away from the least significant, if \[(n-p) \; mod \; 4\cdot5^p = k ,\]

the \(p^{th}\) least significant digit is the \(k^{th}\) term in the series \(D_p\). Thus by knowing that \(D_0(1)=2\),\(D_1(12)=9\),\(D_2(11)=1\),\(D_3(10)=8\). We can tell that the number \(2^{50000013}\), must end in the digits \(8192\).

However, the last part of the problem is how to generate the series \(D_p\) for any given \(p\). Well we can tell that each has \(4\cdot5^p\) terms, but can be stored as \(2\cdot5^p\) terms as the last half of them are the \(9\) conjugate of the first half. We also know that the first \(2p\) terms are zeroes. and there is a chance that the last two digits of the \(S_p\) series are always \(2,4\), making the last two digits of the \(S^{*9*}\) series \(7,5\). The odd revelaing of snippets of information is interesting, it would allow the solution for a very slight number of problems automatically, if there existed such an \(n\) that \(2^n\) just happened to be soluble for each digit based of of this information alone. However it also indicates there could be more information yet to be revealed. A closed form would be quite spectacular, as it would be much easier to write such numbers as \(2^{123456789}\) or even larger, (or at least specify a given digit upon request). Although from what has been found alone we can also tell that, for example \(2^{5000013}\) must end in \(8192\), also, and so forth.