*Originally posted by FabianFnas*

**If a not divisable by 5, hmm, what about when a is divisable by 5? Like 12345^5-12345 ?
**

But even if you don't know Fermat and what he says you can come to the correct result quite easy.

Edit: ... and now I see that Agerg has came up with a correct result. Well done!

well, clearly when a is divisible by 5, a=0 (mod 5) and so a^5=0 (mod 5)... so a^5-a = 0 (mod 5). The nonzero modulo classes are interesting because we can invoke Fermat's Little Theorem, a^p-1 = 1 (mod p) for any prime p. I think this is what Tricky Dicky was saying.

In fact, this proves that it is true for ALL prime number exponents, not just 5. Since a^(p-1)=1 (mod p), we see that a^p = a (mod p) and a^p - a = 0 (mod p).

So 12345^71-12345 is divisible by 71... and so forth. Fermat's "Little Theorem" is quite powerful ðŸ™‚

Edit: note, similarly to what Tricky Dicky said, a^p-1 = 1 (mod p) is only true when p does not divide a. but if it does, a^p = 0 (mod p) and a = 0 (mod p)... so the result a^p - a = 0 (mod p) still holds