I could prove that this is statement is true if $m=1$ or if $m$ is prime.
However, I couldn't prove that the statement doesn't hold if $m>1$ is not prime.
Any hints?
I could prove that this is statement is true if $m=1$ or if $m$ is prime.
However, I couldn't prove that the statement doesn't hold if $m>1$ is not prime.
Any hints?
Prime isn't what you're looking for, it's only a subset of what you want. Consider $m = 6$. Then,
$1^2 \equiv 1$, $2^2 \equiv 4$, $3^2 \equiv 3$, $4^4 \equiv 2$, and $5^5 \equiv 1$. Thus, the conditions are satisfied, but $6$ is obviously not prime.