# Can Fermat's Little Theorem be applied to non-integer rational numbers?

Let $m$ and $n$ be relatively prime integers, with $n \ne 0,1$, so that $a=m/n$ is a non-integer rational fraction. Let $p$ be an odd prime.

QUESTION 1: Can Fermat's Little Theorem be applied, i.e., can one say $a^p \equiv a\!\pmod{p}$, without any further consideration/explanation?

To that end,

QUESTION 2: Are there any proofs (preferably well-known results) that do this?

If $p$ divides $n$, $m/n \mod p$ makes no sense. If $p$ divides $m$, $a^p \equiv a \equiv 0 \mod p$. If $p$ divides neither, $a^{p-1} \equiv m^{p-1}/n^{p-1} \equiv 1 \mod p$.
• You need to assume that $$p\nmid n$$ (division by $$p$$ amounts to division by zero when doing arithmetic $$\pmod p$$, so is a no-no).
• We can work in the ring $$R_p=\{\frac mn\in\Bbb{Q}\mid \gcd(n,p)=1\}.$$
• This ring has an ideal $$P_p=\{\frac mn\in\Bbb{Q}\mid \gcd(n,p)=1,\ \text{m is divisible by p}\}.$$ Basically the ideal consists of the numbers $$px, x\in R_p$$, so we can say that the ideal $$P_p$$ consists of the elements of $$R_p$$ that are divisible by $$p$$.
• We have $$x^p\equiv x\pmod{P_p}$$ for all $$x\in R_p$$. In other words, the difference $$x^p-x$$ is an element of $$P_p$$ (divisible by $$p$$ if you wish).
Alternatively (when $$\gcd(n,p)=1$$) the residue class of $$n$$ has an inverse modulo $$p$$. IOW there exists an integer $$n'$$ such that $$nn'\equiv1\pmod p$$. We can then define $$m/n=mn'$$ (think: $$m/n=m\cdot n^{-1}$$). Of course, the Little Fermat relation $$a^p\equiv a\pmod p$$ holds for $$a=mn'$$, and in this sense the result also makes sense.