Given positive integers $a,b$ and $n$, prove that there exists a positive integer $x$ such that $$a^x + x \equiv b \pmod n.$$ So I found this problem on the aops. You can find a couple of answers there, but one I personally prefer is the following, (I'll add in more details to it)
Let's proceed by strong induction, suppose $\forall k<n$ $\exists x$ such that $k\mid a^x+x-b$. Then since $\phi(n)<n$ there must be an $m$ such that $\phi(n)|a^m+m-b$. Write $a^m+m-b=T\phi(n)$ then choose $M=tn\phi(n)-(T\phi(n)-m)>0$ So $$a^M+M\equiv a^{tn\phi(n)-(T\phi(n)-m)}+tn\phi(n)-(T\phi(n)-m)\equiv a^m-m-T\phi(n)\equiv b\pmod n$$ This is all well and good till you realize that we used Euler's theorem and we need $(a,n)=1$. Unfortunately I was not able to fix this when $(a,n)>1$ But I think I have a solution when $a$ is a prime,
First I'll prove an important result when $a=p$ : If $x$ exists then there are infinitely many such $x$, if $p\nmid n$ then let $x_i=x+in\phi(n)$ and check that they all work. If $p\mid n$ write $n=p^rs$ with $(p,s)=1$ so $$p^{x_i}\equiv p^{x+in\phi(n)}\equiv p^x\pmod{p^rs}\iff p^{in\phi(n)}\equiv 1 \mod \frac{p^rs}{(p^r,p^x)}$$
I claim $r\le x$, indeed $r>x\implies p^x\mid p^rs=n$ but $p^x+x\equiv b\pmod n\equiv b\pmod{p^x}$ so $p^x\mid x-b$ absurd unless $x=b$ but that implies $n\mid p^x$ which is absurd. So $\iff p^{in\phi(n)}\equiv 1 \pmod s$ Which is true. Now we're ready to finish it off,
Let $a=p$, if $p\nmid n$ proceed as the first proof. If $p\mid n$ then write $n=p^rs$ with $(p,s)=1$. Therefore $$p^M=a^{\phi(n)(tn-T)+m)}\equiv p^m\pmod{p^rs}\iff p^{\phi(n)(tn-T)}\equiv 1\mod \frac{p^rs}{(p^r,p^m)}$$ Taking $m$ to be big enough (We're allowed to do that because of the above result) we get $\iff p^{\phi(n)(tn-T)}\equiv 1\pmod s$ which is true because $s\mid n\implies \phi(s)\mid \phi(n)$ so we can write $\phi(n)=\phi(s)q$ to get $$p^{q\phi(s)(tn-T)}\equiv 1\pmod s $$