Math CentralQuandaries & Queries


Question from Jay:

I've seen solution methods for finding the last 2 digits of a^k = N, where a and k are known. My question is:

What if the number N is known and the last 2 digits are, say, ...62. Is there a way to find, for
any given a, the value of k which will result in a number where the last 2 digits are ...62? and if
that is possible, then do the same for a number with the last n digits (say 7 or 53 or something)?


Hi Jay,

I can help somewhat. I want to consider the case of the last two digits but you can extend this to more than two.

Any positive integer $a$ can be written $a = 100 \times s + t,$ for example $67547 = 675 \times 100 + 47 = 67500 + 47.$ Thus

\[a^2 = \left(100 \times s + t\right)^2 = \left(100 \times s\right)^2 + 2 \times 100 \times s \times t + t^{2}.\]


\[a^2 = u \times 100 + t^2 \mbox{ for some positive integer u.}\]

If you carry through this procedure with $a = 67547$ you get $a^2 = 4562595000 + 47^2.$

Thus the last two digits of $a^2 = \left(100 \times s + t\right)^2$ are the same as the last two digits of $t^{2}.$

Using the Binomial Theorem you can see that the last two digits of $a^n = \left(100 \times s + t\right)^n$ are the same as the last two digits of $t^{n}$ for any positive integer $n.$

I hope this helps,

Jay wrote back

Actually, it helps and doesn't help. By that I mean I see what you're saying in the explanation but if you know a and N and you're trying to find that power k which makes $a^k=N$ then it's all a matter of trial and error, searching all k from k=2 onwards until a solution is found. For large numbers it would take forever. I was hoping there was a less labor intensive method.


Actually it's not as bad as it seems. If you are looking at the last two digits of $a^n$ there are only 100 possibilities, 00, 01, 02 and so on up to 99. Hence if you know $a,$ and $t$ is its last two digits there are only 100 possibilities for the last two digits of $t^{n}.$ I used Excel to do the arithmetic in an example.

Suppose that the last two digits in $a$ are 14. The image below is the first 18 rows of an Excl file where the $n^{th}$ row is the last two digits of $14^{n}.$ You can see that the entries in rows 2 and 12 are the same and then the entries repeat. Hence the last two digits on $14^n$ can only be 14, 96, 44, 16, 24, 36, 04, 56, 84, 76 or 64. If the last two digits of $N$ is not in this list then you are out of luck. If it does appear in row $n$ then this is the smallest integer $n$ so that the last two digits of $a^n$ are the last two digits of $N.$ I have attached the Excl file I used so that you can modify it for your use.


About Math Central


Math Central is supported by the University of Regina and The Pacific Institute for the Mathematical Sciences.
Quandaries & Queries page Home page University of Regina PIMS