# Fermat's little theorem

From fermat's little theorem we have for a prime to a prime p : $$a^{p-1}\equiv 1$$(mod p). Assuming p-1 to be even we must have either $$a^{\frac{p-1}{2}}\equiv 1$$ (mod p) or $$a^{\frac{p+1}{2}}\equiv -1$$ (mod p). Are there any special cases in which it is easy to determine which of the previous two conditions holds without a lot of compution?

Last edited: