I am about to solve the following congruence for $x$: $$\begin{align*} x^n\equiv x&\pmod m\quad(1)\end{align*}$$
Where $n\in\mathbb{N},$ and $n$ is coprime to $m$ and $x\in \{0,1,2\dots,m-1\}$.
Another question here, which is almost similar to this one, has already answers for $m\in\text{Primes}$. But I would like to consider a wider case where $m$ can be any odd number which is coprime to $n$. Please guide me if you know of methods for solving this congruence. I think I have to start with checking to see if a solution exists for a given $m$ and $n$.
Examining all possible $x$ is not an option because $m$ is supposedly very big integer.
As a small integer illustration I have calculated (programmatically) $x=69, 70, 91, 92$ for the following congruence (total 4 solutions): $$\begin{align*} x^{158}\equiv x&\pmod {161}\quad(2)\end{align*}$$
please note that we cannot reduce $(2)$ to the following form: $$\begin{align*} x^{157}\equiv 1&\pmod {161}\quad(3)\end{align*}$$ because it seemingly has no solutions because solutions above have no modular inverse modulo $161$.
#EDIT 1: Using chinese remainder theorem is not an option here. Because $p$, as I have mentioned above, is supposed to be a very large integer for which we don't know the factors.