Figuring the Last Digit of x^x^x^x

  • Thread starter Thread starter bob j
  • Start date Start date
bob j
Messages
22
Reaction score
0
Hi All,
suppose I have something like x^x^x^x where x is an integer. Is there any trick to figure the last digit of the result?

Thank you
 
Physics news on Phys.org
You can reduce x modulo 10, the exponent of x by modulo phi(10) = 4, the next exponent by phi(phi(10))=3, and the last by phi(phi(phi(10))=2, can you see why?
 
not really.. could you possibly give me a simple example?
 
I was a bit quick, but basically you make repeated use of Eulers theorem that says a^phi(n) = 1 mod n if gcd(a,n) = 1.

What you want is x^x^x^x mod 10. Say, 13^13^13^13. We can by elementary modulo arithmetic reduce the base mod 10, giving 3^13^13^13. By eulers theorem, we can reduce the exponent by phi(10) = 4 (do you understand this?). Thus we need to find 13^13^13 mod 4. Reducing base: 1^13^13=1, hence giving 13^13^13^13=3^1=3 mod 10.

But, if x is not relatively prime to 10, or phi(10), etc.. you must do some other tricks. Say you want to find 5^5^5^5 mod 10. You can however in this case use that 5^n = 5 mod 10 for all n, hence 5^5^5^5 = 5. This works for any multiple of 5. You can do the even numbers for yourself.

Just try to reduce as much as you can. Finding the last digit is almost always very easy.
 
Back
Top