TITLE: Polynomial with a root modulo every prime but not in $\mathbb{Q}$.
QUESTION [5 upvotes]: I recently came across the following fact from 
this list of counterexamples:

There are no polynomials of degree $< 5$ that have a root modulo every prime but no root in $\mathbb{Q}$. 

Furthermore, one such example is given: $(x^2+31)(x^3+x+1)$ but I have not been able to prove that this does has that property above. How can such polynomials be generated and can we identify a family of them?

REPLY [9 votes]: If you just want an easy example of polynomial that has root modulo every prime but not in $\mathbb Q$ — just take e.g.
$$
(x^2-2)(x^2-3)(x^2-6)
$$
(it has this property since the product of two non-squares mod p is a square mod p).
One more interesting example is $x^8-16$ (standard proof uses quadratic reciprocity).
As for possibility of complete description of all such polynomials — I'm skeptical.