[Math] Pattern on last digits of numbers to a certain power

number theory

There are 4 one-digit numbers which when squared have a last digit equal to the first number. They are 0,1,5 and 6.

There are 2 two-digit numbers which when squared have their last two digits equal to the first number. They are 25 and 76.

There are 2 three-digit numbers which when squared have their last three digits equal to the first number. They are 625 and 376. (i.e. 376^2 = 141376, ends with 376, 625^2 = 390625, ends with 625)

This pattern can be continued for n-digit numbers which when squared have their last n-digits equal to the former number.

This pattern can continue indefinitely. [The proof is left to the reader]

i.e. Prove $5, 25, 625, 0625, 90625, 890625,…$ (we will count 0625 as part of the pattern even though it is not a four digit number as only 0 works and also because it continues the pattern.) and $6, 76, 376, 9376, 09376, 109376, 7109376, 87103976,…$ will continue indefinitely.

However, that cannot just be my question since it's been asked before. (automorphic numbers)

Therefore, what about other powers? ($n^3, n^4$)

[Edit: I forgot to mention and so on. So I actually wanted a general case $n^i$]

Or even to the power of itself? ($n^n$)

Best Answer

Those numbers are called Automorphic numbers (as you just said). There is a longer list here:

https://oeis.org/A007185 is $5^{2^n}$ $\mod 10^n$

https://oeis.org/A016090 is $16^{5^n}$ $\mod 10^n$

There are also other sequences like these for any $a$, coprime to $10$, the Automarphic sequence is $a^{10^n}$ $=$ 1 $\mod 10^n$, and if $a$ $=$ $10x$, then $a^n$ $=$ 0 $\mod 10^n$.

$n^3$, any string of digits ending in 1, 3, 7, 9 can be the ending digits of a perfect cube, for other strings, the last three digits are a multiple of 8, 125 or just 000 (for numbers $n$ divisible by 10)

If $x$ is coprime to 10, then there is an integer $a$ such that:

$a^a$ $=$ $x$ $\mod 10^n$, so it is easy to see that the last digit of $a^a$ is either 0, 1, 3, 4, 5, 6, 7, 9.

Related Question