TITLE: Is it possible for a polynomial to be integer-valued only for prime inputs?
QUESTION [8 upvotes]: Could one write a polynomial that produces an integer output only for prime number inputs? 
I know that if a polynomial of degree $n$ takes integer values at $n+1$ consecutive integer arguments, then it takes integer values at all integer arguments. However, since the prime number inputs aren't consecutive, then how would one go about proving it would be possible to write?

REPLY [7 votes]: Yes.
All polynomials of the form
$$Q(x)+\sqrt2\prod_{k=1}^n(x-p_k)$$ where $Q$ is a polynomial of integer coefficients, are integer only at the primes $p_k$.

Addendum:
The interpretation of the question as "the only integer values of the polynomial over $\mathbb R$ occur at primes" wouldn't make sense as for sufficiently large $n$, the slope of any polynomial exceeds $1$ and the integer values occur at arguments closer than $1$.