Proving that a polynomial cannot output a prime for all natural numbers

Id seen this problem in various math books and contest math forums. It states:

Prove that there is no polynomial p(x) = $$a_0$$ + $$a_1$$x + $$a_2x^2$$ +.....+ $$a_nx^n$$ of n degree with integer coefficients such that p(0), p(1), p(2)... are all primes.

I got around to solving this today and was surprised when I came across, literally, a two line solution:

1.) putting x = 0, we get p(0) = $$a_0$$, which would then, according to the question be prime, and hence a positive integer, going by the standard definition of a prime number

2.) putting x = $$a_0$$, we get p($$a_0$$) = prime = $$a_0$$ + $$a_1a_0$$ + $$a_2a_0^2$$ ....+ $$a_na_0^n$$ = $$a_0$$(1 + $$a_1$$ + $$a_2a_0$$....). Obviously, however, since the coefficients are integers, both these terms are also integers, which would imply that p($$a_0$$) is not prime, which is a contradiction.

i have a feeling theres an obvious error with this, but cant quite point it out. If there is an error, please do tell me the correct solution

1 Answer

It's almost right.

The only problem is that it could be that $$p(a_0) = a_0$$, which would happen if $$1 + a_1 + a_2 a_0 + \ldots + a_n a_0^{n-1} = 1$$. But then you can look at $$p(k a_0)$$ for positive integers $$k$$: these would also be divisible by $$a_0$$, by a similar argument, so they would have to be $$a_0$$. But a polynomial of degree $$n > 0$$ (you did assume $$n > 0$$, right?) can only take a given value at most $$n$$ times.