Proof that no polynomial with integer coefficients can only produce primes [duplicate]

Hint $ $ If $\,q(n)\,$ is prime for all $\,n\,$ then $\,q(0) = p\,$ is prime, thus $\, p\mid q(pn)\,$ and $\,q(pn)\,$ is prime, hence $\,q(pn) = p\,$ for all $\,n.\,$ Thus the polynomial $\,q(px)-p\,$ has infinitely many roots so is zero, i.e. $\,q(px) = p\,$ is constant, hence $\,q(x)\,$ is constant.

Remark $ $ More generally it is easy to show a nonconstant polynomial has a composite value (over any UFD with few units).


I would argue differently, even allowing for the fact that $p(0) = \pm 1.$ First of all, if $p(x)$ is not a constant , then $p(n) \to \pm \infty $ as $n \to \infty,$ for if $p$ has degree $d$, say $p(x) = a_{d}x^{d} + \ldots + a_{1}x+ a_{0},$ then $\frac{p(x)}{x^{d}}$ tends to $a_{d}$ as $x \to \infty.$ Suppose that $p(n)$ is either $\pm 1$ or $0$, or $\pm$ (some prime) for every integer $n.$ Let $h$ be the smallest positive integer such that $p(h) \not \in \{-1,0,1 \}.$ There is such an integer $h$ by the earlier remark. Suppose that that $p(h) = \pm q$ for some prime $q.$ Then for every positive integer $t,$ we see easily that $p(h+qt)$ is divisible by $q.$ But for large enough $t,$ we see that $p(h+tq) \not \in \{,-q,0,q \},$ so that $p(h+tq)$ is not prime (and is not $\pm 1$ either).