TITLE: A Hard Number Theory Problem $f(n+1)=f(n)+2^{f(n)}$
QUESTION [5 upvotes]: Define a function $f:\mathbb N\to\mathbb N\quad$ by $\begin{cases}f(1)=1\\f(n+1)=f(n)+2^{f(n)}\ \text{ for every integer }n\end{cases}$
Prove that $f(1),f(2),\cdots,f(3^{2013})$ leave distinct remainders when divided by $3^{2013}$

I got this problem from a telegram group posted by someone who did not reveal the source of the problem.
My approach : After seeing this problem I tried to make a list of values but coudn't proceed for much longer as soon it reaches higher for large values of 2^n . But one thing is clear that this function is clearly increasing for positive. Finding the closed form for the recurrence seems not possible. So after this I dont have any ideas.
I request a help in this problem.

REPLY [6 votes]: We first point out a result that's essential here: $2^a \equiv 2^b \text{ mod } 3^n$ if and only if $2 \cdot 3^{n-1} | a-b$. This is because $2^{3^n} \equiv -1 \text{ (mod } 3^{n+1}$).(easily proved using induction)
Next we prove the following claim by induction on $m$:
\begin{equation}
f(i) \equiv f(j) \text{ (mod $3^m$)} \text{ if and only if } i \equiv j \text{ (mod $3^m$)}.
\end{equation}
Assume it is true for $m$, then the set of any consecutive $3^m$ terms of $f(n)$ mod $3^m$ is $\{ 0, 1, \cdots, 3^m-1 \}$. (also notice all $f(n)$ are odd.)
\begin{equation}
\begin{split}
f(i+3^m)-f(i) & = 2^{f(i)} + 2^{f(i+1)} + \cdots + 2^{f(i+3^m-1)} \\
& \equiv 2^1+2^3+\cdots+2^{2 \cdot 3^m-1} \\
& = 2 \cdot \frac{2^{2\cdot 3^m}-1}{2^2-1} \equiv 2 \cdot 3^m \text{ (mod $3^{m+1}$)}
\end{split}
\end{equation}
With this, it follows case $m+1$ is true.