Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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$.

share|cite|improve this question
$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
up vote 13 down vote accepted

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).

share|cite|improve this answer

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.

share|cite|improve this answer

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}$






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$.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.