Let $p$ be an odd prime and let $m = 2p$. Prove that $$a^{m−1} ≡ a \pmod{m}$$ for all natural numbers $a$.
My attempts
If $m$ is relatively prime to $a$, then $a^{\phi(m)}\equiv1\pmod{m}$ so $$a^{p-1}\equiv1\pmod{m}$$ $$a^{p}\equiv a\pmod{m}$$ Together implies $a^{2p-1}\equiv a\pmod{m}$ that $a^{m-1}\equiv a\pmod{m}$
If $m$ is not relatively prime to $a$, then exists some prime divisor $d$ such that $d$ divides $a$ and $d$ divides $m$, since $m=2p$ we have $d=2$ or $d=p$
Suppose $d=2$ that $\dots$
Now i'm stucked here, any ideas about how to prove this? Thanks for your help.