What makes $5$ and $6$ so special that taking powers doesn't change the last digit?

Why are $5$ and $6$ (and numbers ending with these respective last digits) the only (nonzero, non-one) numbers such that no matter what (integer) power you raise them to, the last digit stays the same? (by the way please avoid modular arithmetic) Thanks!


Solution 1:

The problem is solving $x^2\equiv x\pmod{10}$, or $x(x-1)\equiv 0\pmod{10}$, which means finding integers $x$ such that $10$ is a factor of $x(x-1)$. For that to hold, either $x$ or $x-1$ must be a multiple of $5$, which means the last digit of $x$ is $0,1,5,$ or $6$. Then it is a simple verification that the equation holds in each of these cases.


Rephrased without "$\pmod{10}$" notation, this could be expressed as follows. We are looking for integers $x$ such that $x$ and $x^2$ have the same last digit. This is the same as saying that the last digit of $x^2-x=x(x-1)$ is $0$. That means that $x(x-1)$ is a multiple of $10$. See above for the rest.

Solution 2:

Modular arithmetic is the most convenient and powerful language to express the explanation in, but there is a low-tech version. The desired condition is equivalent to just $x$ and $x^2$ having the same units digit, which is equivalent to $10\mid (x^2-x)=x(x-1)$, which is equivalent to

$$10\mid x(x-1)\implies \begin{cases}10\mid x \\ 2\mid x, ~ 5\mid (x-1) \\ 5\mid x,~2\mid(x-1) \\ 10\mid (x-1)\end{cases}\implies \rm units~digit=\begin{cases}0 \\ 6 \\ 5 \\ 1\end{cases} $$


In base $b$, an integer $x$ has the same units digit no matter what power you raise it to if and only if $x$ has the same units digit as $x^2$, or equivalently $x^2\equiv x\bmod b$. This occurs when $b\mid x(x-1)$. The set of $x$ for which this occurs can be precisely characterized.

For each divisor $d\mid b$ such that $\gcd(d,b/d)=1$, the set of solutions $x$ to the system

$$\begin{cases} x\equiv 0 \bmod d \\ x\equiv 1\bmod b/d\end{cases}$$

satisfy the desired condition, and every desired $x$ is attained in this way. Using SZ aka CRT,

$$\{d\cdot\big(d^{-1}\bmod b/d\big)+bn:~d\mid b,\,\gcd(d,b/d)=1,n\in{\bf Z}\}$$

is the set of all $x$ s.t. $x,x^2,x^3,\cdots$ all have the same units digit in base $b$.

Solution 3:

The best way to see why is to perform long multiplication. If we multiply together numbers that end in six (say, ones that are three digits long, but without loss of generality) it follows this pattern:

    AB6
  x CD6
  -----
   EFG6
  HIJK
 LMNO
=======
PQRSTU6

The two least significant digits are six, and they multiply out to 36. So in the first partial product, we "write down the 6, and carry the 3". This 6 that we write down produces the units digit in the final result. Nothing from the other partial products will add to this 6 and so it is preserved through to the final product. Only the first partial product determines the units digit. The next partial product affects only the tens and up, the one after that from the hundreds and so on. This is clear in the long multiplication by the diagonal layout.

And so all (non-zero, positive integral!) powers of 6 must end in a 6. This is because, first of all, $6^1 = 6$ ends in 6, and all other powers are formed from that one with additional multiplications by 6, so we are always multiplying together numbers ending in 6 which we know always lead to products ending in 6.

Powers of 6 are in fact only only a small subset of the numbers that are formed by multiplying two factors ending in 6. For instance 16 isn't a power of 6 and neither is 26. Yet their product, also not a power of 6 is 416.


Now, if we want to get slightly more rigorous, and leave behind long multiplication, we can do that without a lot of difficulty. Let us rewrite our mystery representative numbers AB6 and CD6 this way: $100A + 10B + 6$, and $100C + 10D + 6$. Now what is their product? It is:

$$(100A + 10B + 6)(100C + 10D + 6)$$

When we multiply these together, following the FOIL method, it's clear that the only number that is not divisible by 10 will be the last term: $6\times 6 = 36$:

$$100A\times 100C + 100A\times 10D + 100A\times 6 + 10B\times 100C + 10B\times 10D + 10B\times 6 + 6\times 100C + 6\times 10D + 6\times6$$

$$= 10000AC + 1000(AD + BC) + 100(6A + BD + 6C) + 10(6B + 6D) + 36$$

$$= 10(1000AC + 100(AD + BC) + 10(6A + BD + 6C) + 6B + 6D) + 36$$

I.e. it's 10 times something, plus 36, which has to end in 6.