# A Prime Formula

A team of mathematicians in Canada and Japan discovered this remarkable polynomial in 1976 — let its 26 variables a, b, c, … z range over the non-negative integers and it will generate all prime numbers:

$\displaystyle (k+2)(1-\newline [wz+h+j-q]^{2}-\newline [(gk+2g+k+1)(h+j)+h-z]^{2}-\newline [16(k+1)^{3}(k+2)(n+1)^{2}+1-f^{2}]^{2}-\newline [2n+p+q+z-e]^{2}-\newline [e^{3}(e+2)(a+1)^{2}+1-o^{2}]^{2}-\newline [(a^{2}-1)y^{2}+1-x^{2}]^{2}-\newline [16r^{2}y^{4}(a^{2}-1)+1-u^{2}]^{2}-\newline [n+\ell +v-y]^{2}-\newline [(a^{2}-1)\ell ^{2}+1-m^{2}]^{2}-\newline [ai+k+1-\ell -i]^{2}-\newline [((a+u^{2}(u^{2}-a))^{2}-1)(n+4dy)^{2}+1-(x+cu)^{2}]^{2}-\newline [p+\ell (a-n-1)+b(2an+2a-n^{2}-2n-2)-m]^{2}-\newline [q+y(a-p-1)+s(2ap+2a-p^{2}-2p-2)-x]^{2}-\newline [z+p\ell (a-p)+t(2ap-p^{2}-1)-pm]^{2})\newline >0$

The snag is that it will sometimes produce negative numbers, which must be ignored. But every positive result will be prime, and every prime can be generated by some set of 26 non-negative integers.

(James P. Jones et al., “Diophantine Representation of the Set of Prime Numbers,” American Mathematical Monthly 83:6 [1976], 449-464.)