Let b(i,j) for 1≤i,j≤n+1 be positive integers in which for every i,j,k,l where {i,j}={k,l}, we have (b(i,j),b(k,l))=1 and b(i,j)=b(j,i). According to Lagrange interpolation formula, there exists a unique polynomial P(x) with rational coefficients of degree at most n that satisfies ∀1≤i≤n+1,P(ai)=∏j=1n+1b(i,j). Then we'll have:
(P(ai),P(aj))=b(i,j)>1,(P(ai),P(aj),P(ak))=(b(i,j),P(ak))=1
Therefore, it suffices to prove that there is a sequence b(i,j) in which the resulting polynomial P has integer coefficients in lieu of rational. According to Lagrange interpolation formula,
P(x)=i=1∑nP(ai)∏j=1,j=in(ai−aj)∏j=1,j=in(x−aj)
Define c to be c=∏i=1n+1∏j=1,j=in+1(ai−aj). Redefine b(i,j) so that in addition to former conditions, for every (i,j), b(i,j)≡1(modc). Obviously such sequence b(i,j) exists, as it's equivalent to existence of 2n(n+1) pairwise distinct positive integers all being 1 modulo c, and the sequence
c1=1,∀2≤i≤2n(n+1):ci=cj=1∏i−1cj+1
works well. Furthermore, P(ai)=∏j=1n+1b(i,j)≡1(modc).
It remains to prove that for such P(ai), P would have integer coefficients. Define kj to be kj=cP(aj)−1. According to Lagrange interpolation formula for constant polynomial 1, we have
1=i=1∑n∏j=1,j=in(ai−aj)1⋅∏j=1,j=in(x−aj)=i=1∑n∏j=1,j=in(ai−aj)(P(ai)−cki)∏j=1,j=in(x−aj)=i=1∑n∏j=1,j=in(ai−aj)(P(ai))∏j=1,j=in(x−aj)−i=1∑n∏j=1,j=in(ai−aj)cki∏j=1,j=in(x−aj)=P(x)−i=1∑nkij=1,j=i∏n(x−aj)∏j=1,j=in(ai−aj)c
But by definition ∏j=1,j=in(ai−aj)∣c. Therefore,
i=1∑nkij=1,j=i∏n(x−aj)∏j=1,j=in(ai−aj)c
has integer coefficients, and so does P(x).