# The last digit of $n^5-n$

What will be the last digit of $$n^5 - n \bmod 1000,$$ where $n$ is a natural number and $m \bmod 1000$ is the remainder when $m$ is divided by $1000$.

-
$0$. The last digit of $n^5$ is always the same as the last digit of $n$. –  Henning Makholm Nov 26 '11 at 4:11

The question is exactly the same as asking what is the last digit of $n^5-n$, since the remainder when dividing a number by $1000$ is just the last three digits of the number. The last digit of the number is the remainder when dividing by $10$, so your question is really the same as asking what is $$n^5 - n \bmod 10.$$

By Fermat's Little Theorem, $n^5\equiv n\pmod{5}$; and it is easy to verify that $n^5\equiv n\pmod{2}$. Therefore, $n^5\equiv n\pmod{10}$, so $n^5$ and $n$ have the same last digit, hence the last digit will be $0$.

(Of course, one could also simply check that if $n$ ends with $0$, then so does $n^5$; if $n$ ends with $2$ then so does $n^5$, etc).

-

HINT $\$ For primes $\rm\:p\ne q,\:$ by $\mu$Fermat, $\rm\: p-1,q-1\ |\ k-1\ \Rightarrow\ p,q\ |\ n^k-n\ \Rightarrow\ p\:q\ |\ n^k-n$

Now let $\rm\:p,q,k = 2,5,4\:.\:$ More generally we have the following Fermat-Euler-Carmichael

THEOREM $\$ For naturals $\rm\: k,m>1$

$\rm\qquad\qquad\ m\ |\ n^k-n\$ for all $\rm\:n\in\mathbb N\ \iff\ m\:$ is squarefree and prime $\rm\: p\:|\:m\: \Rightarrow\: p-1\ |\ k-1$

For related results see some of my prior posts.

-

The unit digit of $n^{4k+1}$ is same as the unit digit of $n$

This is because the unit digit is periodic with period $4$,or $2$, or $1$, For instance

$2^1=2 _{U.D=2}$

$2^2=4_{U.D=4}$

$2^3=8_{U.D=8}$

$2^4=16_{U.D=6}$

$2^5=32_{U.D=2}$

$2^6=64_{U.D=4}$

Hence we observe that the unit digit is $2,4,8,6$ and it oscillates with period $4$, in case of $2^n$, For numbers like $5^n$,$11^n$,$6^n$ this period is $1$, and for $9^n$ the period is $2$.

Hence the last digit of $n^5-n$ is $0$.

-