# Elementary Number Theory exponents [duplicate]

How can one prove that the fifth power of any number has the unit digit same as that of the number itself.

Actually the question was to prove that $n^5-n$ is divisible by $30$ when n is a number prime to 5 and hence prove that the unit digits of the fifth power of a number is equal to the unit digit of number itself.

The first part was easy to be proved, I just took numbers $5m\pm1;5m\pm2$ and proved the rest using binomial theorem(for opening the expression) and mathematical induction. But in the second part I am completely clueless.

Please use only elementary number theory to prove the given statement.

## marked as duplicate by Daniel FischerJun 8 '16 at 11:32

• Just take the fifth powers of $\;0,1,2,...,9\;$ ...I doubt it can get any more elementary than that. – DonAntonio Jun 8 '16 at 7:15
• Think about the fifth power of $(10k+d)$. The last digit is unaffected by the value of $k$ - it depends solely on $d$, which is why you only need to look at the fifth powers of 0,1,...,9. – almagest Jun 8 '16 at 7:20
• To aspiring answer writers: the key phrase here is "and hence prove", so the result proven in the first part must be used to prove the second part. – PM 2Ring Jun 8 '16 at 7:43

You have already proved that $n^5 - n$ is divisible by $30$. But by definition this means $n^5 = n + 30k$ for some integer $k$ (which depends on $n$). When you add a multiple of $10$ to a (nonnegative) integer, the last digit doesn't change.

This leaves only the case that $n$ is divisible by $5$, but actually $n^5-n$ is always divisible by $30$ regardless of whether $n$ is relatively prime to $5$, and you can prove this the same way. Or else you can just work out the last digit of $n^5$ when $n$ ends in $0$ or $5$.

• Thanks a lot for such a simple and nice answer. – Harsh Sharma Jun 8 '16 at 9:08

think in terms of the ring $Z_{10}$

the cases $0$ and $1$ are trivial

for the remaining elements in the group of units i.e. $\{3,7,9\}$, we know the group has order 4 so for these elements $x^5 \equiv_{10} x$.

since $2^5 \equiv_{10} 2$, then combining this with the results for $\{3,7,9\}$ we see by multiplicativity that $\{6,4,8\}$ also satisfy the equation

this leaves $5$, which is idempotent.

• Thanks a lot. Though I am new in this field and am not been able to learn much because of not having any teacher and therefore I couldn't understand your proof but still its commendable that you spared your time to write the answer. – Harsh Sharma Jun 8 '16 at 11:30

In the second part you need to prove
$n^5 \equiv n (mod 10)$ Since $(2,5)=1$ So just to prove $n^5 \equiv n (mod 2)$ And $n^5 \equiv n (mod 5)$ Which can be proved very easily by induction . Combining these will give the required answer. $$edit$$ : since $30$ divides $n^5-n$ i.e. $3×10$ divides $n^5-n$ or we can say $10$ divides $n^5-n$ which gives the direct approach . If you want to prove the second part separately you can do the above proof .

• thanks a lot for showing me such a nice approach. – Harsh Sharma Jun 8 '16 at 9:09
• @Harsh Sharma you are welcome ☺ – Shona Jun 8 '16 at 9:37

Firstly, there's a simpler way to prove the first part than the method mentioned in the question.

Although the question initially asks about $n$ coprime to 5, $30|(n^5 - n)$ is actually true for all $n$, saying that $n$ is coprime to 5 is really a hint that it may be useful to work in modulus 5 at some stage of the proof.

Before we commence we need a lemma:

If $p|n$, $q|n$, with $gcd(p, q) = 1$, then $pq|n$.

This follows from the Fundamental theorem of arithmetic, but let's show it via Euclid's lemma and Bézout's identity.

Since $p|n$ and $q|n$, $\exists\, u, v:$ $$n = pu = qv$$ Also, $\exists\, x, y:$ $$px + qy = 1$$ Multiplying by $n$ and substituting, $$pxqv + qypu = n$$ $$pq(xv + yu) = n$$ Hence $pq|n$

Now we'ready to prove the first part.

Let $f(n) = n^5 - n$. We want to show that $30|f(n)$.

$30 = 2\cdot3\cdot5$ so if we prove that each of 2,3 & 5 divide $f(n)$, then by our lemma $30|f(n)$; in addition we also get $15|f(n)$, $10|f(n)$, and $6|f(n)$ "for free".

Factorising,

\begin{align} f(n) & = n^5 - n\\ & = n(n^4 - 1)\\ & = n(n^2 - 1)(n^2 + 1)\\ & = n(n-1)(n+1)(n^2 + 1)\\ \end{align}

Exactly one of $\{n-1,\, n,\, n+1\}$ must be divisible by 3, and at least one of them must be even, so by our lemma $6 | (n-1)n(n+1)$ and $6|f(n)$.

[Aside: it is easy to show that any sequence of $m$ contiguous integers is equivalent $\mod m$ to ${k: 1 \le k \le m}$, so the product of that sequence must be divisible by each $k$ in the set and hence is divisible by $m!$.]

Now we need to show that $5|f(n)$. Working mod 5, $n \equiv$ one of $0, \pm1, \pm2$.

Clearly, $n(n-1)(n+1) \equiv 0 \mod 5$ for $n$ congruent to one of $0, \pm1$. For $n\equiv 0$ the 1st factor $\equiv 0$; for $n \equiv 1$, the 2nd factor $\equiv 0$; for $n \equiv -1$, the 3rd factor $\equiv 0$.

Now we need to look at the last factor of $f(n)$, i.e., $n^2+1$.

For $n \equiv \pm2, \, n^2+1 \equiv 4 + 1 \equiv 0$.

So $5|f(n)$ for all $n$, and thus by our lemma, and the previous result, $30|f(n)$.

Now for the second part.

Since $10|30$, $10|f(n)$ (but our lemma and proof technique in the first part also allows us to conclude $10|f(n)$), so $n^5 - n \equiv 0 \mod 10$ and $n^5 \equiv n \mod 10$.
But $N \mod 10$ is simply the final digit of $N$ written in base 10, so the last digit of $n^5$ is the last digit of $n$