# Power of very big numbers

So, I was solving a question, and I came across this.

If I have, x=a^b, and If I want to calculate the last digit of x, then it will be equivalent to the power of the last digit of a powered to b.

For example, the last digit of

56^78 will be equal to the last digit of 6^8.

75^74 wil be equal to the last digit of 5^4.

Am I right in saying this? This seems to be correct for all cases. Is this right?

PS: This will be useful if I wish to calculate the last digit of very big numbers. ( like having 1000 digits or so)

• Yes, it is right. We can use congruence language to prove this, but thinking about the ordinary multiplication procedure will also work. – André Nicolas Oct 2 '14 at 4:24
• Added another edit to my answer because I missed your inaccuracy the first time. You have to consider the entire exponent, not just the last digit. – Deepak Oct 2 '14 at 4:45

No, this is not correct. For example, The last digit of $2^{10}=1024$ is $4$, but the last digit of $2^0$ is 1. There are many small counter examples; three more are $13^{14}$, $3^{11}$, and $12^{12}$.

• +1 for spotting the error in the question I missed the first time around. – Deepak Oct 2 '14 at 4:46

More precisely, the last digit of $x = a^b$ will be the last digit of the number given by the last digit of $a$ raised to the power of $b$.

This is easy to prove. In base $10$ notation, let $a = 10^na_n + 10^{n-1}a_{n-1} + ... + 10a_1 + a_0$.

Now $x = a^b \equiv a_0^b \pmod {10}$.

EDIT: just wanted to add that there's nothing special about base $10$. It will work in any base, as long as the same base is used throughout. I just used decimal notation for convenience because that's the usual convention.

Another edit: Sorry, just read your question more carefully (I think Andre also skimmed over that the first time. :) ). You cannot take just the last digit of $b$. You have to consider the entire exponent. However, you can take just the last digit of $a$.

• Sorry, but more precisely, the last digit of x will be the last digit of the number given by the last digit of a raised to the number given by the last digit of b, right? – Qirohchan Oct 2 '14 at 4:33
• @Qirohchan: The last digit of $b$ stuff you mention is not right. – André Nicolas Oct 2 '14 at 4:40
• No, that last bit isn't right. You have to consider the whole number $b$. For example $12^{11}$ ends with an $8$. But $2^1 = 2$ so that isn't right. However $2^{11}$ indeed ends with an $8$. – Deepak Oct 2 '14 at 4:41