how to give power to a digit
Answers
How do I find the last digit of any number raised to any number?
If the number ends with 1, last digit will always be 1
If it ends with 6, the last digit will always be 6
In it ends with 0 or 5, the last digit will be 0 or 5 respectively
If it ends with 4, the last digit will alternate between 4 and 6 for subsequent powers
If it ends with 9, it will alternate between 1 and 9 for subsequent powers
In case of 3 or 7, it will cycle with 3->9->7->1->3 for 3, and 7->9->3->1->7 for 7, repeatedly, just modulo the power with 4, and you can find the last digit, using the above result by raising the number to the power (result from modulo by 4).
If the unit digit is 2 or 8, the last digit will cycle with 2->4->8->6->2 in case of 2 , and 8->4->2->6->8, in case of 8, and just doing modulo of the power with 4, will give you a result, with which you can find the last digit using above cycle