8

It seems like there is no polynomial with finite variables known, which could generate all prime numbers, by integer assignments. Is there a proof that such polynomial can not exist and does anyone have one in his/her stack?

Bill Dubuque
  • 272,048
Hooman
  • 3,647
  • You might be interested in: http://mathworld.wolfram.com/Prime-GeneratingPolynomial.html – Amzoti Sep 10 '12 at 22:28
  • 3
    It is confusing to ask one question in the title and a different question in the body (in the body you don't specify what the coefficients should be). The body of the question should be self-contained (I usually don't go back up to the title to see if there's any extra information there and I'm sure I'm not the only one). – Qiaochu Yuan Sep 11 '12 at 03:34
  • There is a polynomial $f(p,x_1,\ldots,x_n)$ with coefficients in $\mathbb Z$ such that $p$ is a positive prime number if an only if $\exists x_1\in\mathbb Z\ \cdots\ \exists x_n\in\mathbb Z\ f(p,x_1,\ldots,x_n)=0$. If I recall correctly it can be done with $\deg f=4$ and $n=14$. ${}\qquad{}$ – Michael Hardy Aug 09 '14 at 12:44
  • Related: https://math.stackexchange.com/questions/59846/proof-of-no-prime-representing-polynomial-in-2-variables – Watson Oct 24 '16 at 07:45

3 Answers3

12

In fact there does not even exist a non-constant polynomial $f$ (I assume you want integer coefficients) which only takes prime values with integer inputs. It suffices to prove this for polynomials in one variable. By the hypothesis that $f$ is non-constant, it takes arbitrarily large values, so without loss of generality $|f(0)| > 1$; in particular, $f(0)$ is divisible by some prime $p$. Then $f(kp)$ is always divisible by $p$, hence cannot be prime for sufficiently large $k$.

However, remarkably there do exist polynomials in more than one variable all of whose positive values are prime.

Qiaochu Yuan
  • 419,620
  • 1
    The question asked for rational coefficients, and the argument fails in this case. For example, $f(x)=(x^2+x+4)/2$ is integer-valued with rational coefficients, and $f(0)=2$ is divisible by the prime, 2, but $f(2)=5$ is not divisible by 2. – Gerry Myerson Sep 11 '12 at 03:16
  • 2
    @Gerry: oh, I see; rational is specified in the title. That's confusing. In any case, rational coefficients is not a problem: just ensure in addition that $k$ is divisible by the least common denominator of the coefficients. In your example, $f(4)$ is divisible by $2$. – Qiaochu Yuan Sep 11 '12 at 03:33
1

Here, it is clear that by hand-picking values, it is clear that there is no all-prime generating polynomial. It is even possible to demonstrate that there are infinite composite values to the function as well.


First of all, we state that a polynomial with integer input, and integer coefficients will only give integer output. This is because any positive power (the exponent in the function) of an integer is also an integer, and an integer multiplied by an integer (coefficient) is also an integer.

We write a general polynomial function in the form: $$f(x)=a_mx^m+a_{m-1}x^{m-1}+\cdots+a_2x^2+a_1x^1+a_0x^0.$$ Note that it is allowed in this proof for individual values of $a$ to be $0$, even the $a_m$, but just that there must be at least one non-constant term!

Now, we let the arbitrary integer $n$ be of the form $ka_0$ where $k$ can be any integer. We substitute $x=ka_0$ into the polynomial form, which gives us: $$f(n)=f(ka_0)=a_m(ka_0)^m+a_{m-1}(ka_0)^{m-1}+\cdots+a_2(ka_0)^2+a_1(ka_0)^1+a_0(ka_0)^0.$$ Let's expand that: $$f(ka_0)=a_mk^ma_0^m+a_{m-1}k^{m-1}a_0^{m-1}+\cdots+a^2k^2a_0^2+a^1k^1a_0^1+a_0k^0a_0^0.$$ We notice that every term in the new expression has a factor of $a_0$! This means that $a_0$ is a factor of the value of the polynomial output.

Here, we notice that we defined $k$ as any arbitrary integer, so we can set it to any value we want. This gives us infinite outputs for the function as composite numbers, since $k$ can be any desired integer. $\square$

  • 2
    This is just an expansion of the accepted answer from >8 years ago, and it doesn't deal with the laxer condition that the coefficients are rational from the title. – KReiser Feb 13 '21 at 05:43
0

Consider a polynomial $P(n)$ with integer coefficients; also, assume that the constant term (coefficient of $n^{0}$), is $a_{0}$.

If $a_{0}\neq 1$, then, putting $n=c*a_{0}$, where c is a non-zero integer, shall yield a multiple of $a_{0}$.

In general, $P(cP(1)+1)$ shall always be divisible by $P(1)$. Hence, the given polynomial cannot generate only primes!!