The Rise and Fall of Power

http://www.codechef.com/problems/MARCHA4
How can i find the last k digits in n^n,first k digits can be done using logarithms.
Can anyone let me know about last k digits?

If you solved first k digits, last k digits are easier, you can do (n^n)%(10^k).

5 Likes

Thank uā€¦ got it

1 Like