Given an integer $r$, is there a way to determine if there exists a positive integer $n$ such that $2^n \equiv r \bmod n$? What if the condition $0 \leq r < n$ is required?
I came up with this question thinking about Fermat pseudo-prime in base $2$. Of course one can generalize looking at the equation $a^n \equiv r \bmod n$, for a fixed integer $a > 1$, but I think that the case $a = 2$ is already interesting.
Thank you in advance for any idea.
EDIT: It is conjectured that for any integer $r > 1$ there is a solution $n$ (see Robert Israel's answer). Is there some heuristic reason of why it should be so?
It is conjectured that the answer is yes for every nonnegative integer $r$ except $1$. See OEIS sequences A015910 and A036236 and references there.