TITLE: Theorems similar to Euler's theorem ($a$, $n$ are not coprime)
QUESTION [5 upvotes]: It is well known that if $\gcd(a,n)=1$, then $a^{ϕ(n)}=1$ mod $n$.
Are there any results similar to Euler's theorem that can be used when $a$ and $n$ are not coprime.
Feel free to add any restrictions on $a$, $n$ other than $a$, $n$ being coprime.
Thank you.

REPLY [2 votes]: Are you looking for something like the following?
$$\text{For any integers $a$ and $n$, $a^{n} \equiv a^{n-\varphi(n)} \pmod{n}$.}$$