Originally Posted by

**tukilala** lets say that i need to find the last 3 digit of the number: 998^1010

i know that to find the last 3 digits, i need to use modulo 1000

so im looking at the group Z1000 under multiplication, right?

and now: 998^1000 = 998^(999+11) = (998^999)*(998^11)

is it true to say that 998^999 = 1 (by **Lagrange's theorem)**?? **if yes, so why in the group Z6/{0} = {1,2,3,4,5} under multiplication** 5^5≠1 (mod 5). 1000 is not a prime number, so why in this case Lagrange's throrem works?

any way, if its true to say that( and i dont understant yet why) so 998^11 = -2^11 = 1024*(-2) = -48 = 952 (mod 1000)

so the last 3 numbers are:952

so when i can use Lagrange's theorem and when not?