Originally Posted by

**zophas** Hi all,

I have just joined this forum hoping to get some help.

I have just recently started playing with Number Theory and I am trying to

get my head around Modular Arithmatic. So I came across Fermat's Little Theorem,

which says that a^p = a (mod p). Why does this seem to work with some values but not with others? 9^7 = 2 (mod 7) or 12^5 = 2 (mod 5) or 8^5 = 3 (mod 5). Am I missing something here? The other form of the theorem a^(p-1) = 1 (mod p) seems to work just fine. Yes and I do know that the values have to be coprime. Can anyone help me get this?

Thanks.