It is well known that no nonconstant polynomial $f\in \mathbb{Z}[x]$ can assume only prime values at integer arguments. Indeed, if $a\in \mathbb{Z}$ is so large that $|f(a)|>1$, and if $p$ is a prime factor of $f(a)$, then all values of $f(a+pf(x))$ are divisible by $p$.

Question: Can a sequence of the form $f(a),f(f(a)),\ldots$ (for some fixed $a\in \mathbb{Z}$) take on only prime values and tend to infinity?

If $f$ is linear, then the answer to the question is no. To prove this, assume on the contrary that $f^n(a)$ tends to infinity and takes only prime values. Choose $n$ so large that $p:=|f^n(a)|$ is a prime greater than any coefficient of $f$. Then $f$ is a permutation polynomial mod $p$, therefore $f^m(p)$ is divisible by $p$ for infinitely many $m$, a contradiction.

If $f$ is not linear, and if the sequence in question consists only of primes, then (as Dietrich Burde pointed out) $f$ would be a non-linear polynomial taking infinitely many prime values, something that is not known to exist.

On the other hand, if the sequence $f(a),f(f(a)),\ldots$ can never take only prime values (which is my guess) then maybe the problem has a simple solution. Does anyone have any ideas or references?

This is an expanded form of a question posted on Math SE here.