Example: Q(x)=xp−2−1. For any i<j<p:
Q(j)−Q(i)=yp−2−xp−2≡y1−x1(modp),
which clearly isn't divisible by p, and
jQ(j)−iQ(i)=(yp−1−xp−1)−(y−x)≡(x−y)(modp)
also isn't divisible by p.
Suppose that there exists such a polynomial of smaller degree. It follows from the statement that all of Q(1),Q(2),…,Q(p−1) give different remainders modulo p, and also 1Q(1),2Q(2),…,(p−1)Q(p−1) give different remainders modulo p. Let's use the following fact: 1k+2k+⋯+(p−1)k≡0(modp) for any k from 1 to p−2. Then consider 1Q(1)+2Q(2)+⋯+(p−1)Q(p−1). From the fact above, this number is 0 modulo p (as each degree in the polynomial xQ(x) is in the range [1,p−2]). Suppose that among the numbers 1P(1),…,(p−1)P(p−1) there are all remainders modulo p, except for x. Then:
0≡0+1+⋯+(p−1)≡1Q(1)+2Q(2)+⋯+(p−1)Q(p−1)+x≡x(modp),
so 1Q(1),2Q(2),…,(p−1)Q(p−1) modulo p give remainders 1,2,…,p−1 in some order. Then none of Q(1),Q(2),…,Q(p−1) is divisible by p, and they also give remainders 1,2,…,p−1 in some order.
But then:
(p−1)!≡1Q(1)×2Q(2)×⋯×(p−1)Q(p−1)≡(p−1)!2(modp),
which, by the Wilson theorem, gives, −1≡1(modp), this contradiction completes the proof.