Algorithm to compute the k first and last digits of n^n

Hello !

I'm having trouble with this :

I want to write an algorithm that computes the K first and K last digits of n^n.

I know I should use some sort of combination between (a+b)^n and log(n) but I'm really striking out !

Thank you in advance for your help!

Re: Algorithm to compute the k first and last digits of n^n

Hey SummerTime.

Have you got access to a basic number theory book?

Re: Algorithm to compute the k first and last digits of n^n

Hi chiro,

No I don't actually study mathematics so I don't have access. But if you could just point me in the right direction? I will try to learn from around the web.

Thank you