Given $a$ and a modulo $m$, I'd like to ask how to calculate $x$ satisfying that $a^x \equiv x \pmod{m}$?
I notice that such $x$ always exists and can be the infinite tetration of $a$, meaning that $x \equiv a^{a^{a^{\cdot^{\cdot^{\cdot}}}}} \ (mod \ m)$, but I'm not sure whether there are other solutions.
It also happens that this solution is the largest $x \lt m$ satisfying the equation.
$$\begin{align}a^x\equiv x \bmod m&\implies a^x=my+x\\&\implies\nexists p\in \{p : p\mid x\} : \nexists b,\quad b^p\not\equiv x \bmod m\\&\implies\gcd(a,m)\mid x\end{align}$$
Any non-trivial shared factor, via the last one, makes this $0\equiv 0\bmod \gcd(a,m)$ boring. If x is prime we get that a factors mod x . Parity arguments show that if a and m are both odd, then x and y are opposite parity to each other. Lastly, by associativity of multiplication, mod m can be restated into mod any given factor, including prime factors.