Since x2−px+q=0 has integral solution, then we may assume that
{p=a+bq=ab with a,b∈Z+.
Note that q−p+1=ab−(a+b)+1=(a−1)(b−1)≥0 then q+1≥p.
By the same way on the second equation x2−qx+p=0, then we have p+1≥q. Thus p=q or p+1=q or q+1=p. We consider three cases:
1. If p=q then x2−px+p=0 then we have
Δ=p2−4p=k2⇔(p−2)2−k2=4.
Hence, (p−2−k)(p−2+k)=4. Note that (p−2−k)+(p−2+k)=2(p−2) then these numbers have the same parity, so we just need to consider p−2−k=p−2+k=2 or p=4,k=0. In this case, we have one pair satisfies the given condition (p,q)=(4,4).
2. If p+1=q then x2−px+p+1=0, we have
Δ=p2−4p−4=k2⇔(p−2)2−k2=8.
Hence (p−2−k)(p−2+k)=8. Similarly, these numbers have the same parity then p−2−k=2, p−2+k=4 or p=5,k=5. In this case, we have one pair satisfies the given condition (p,q)=(5,6).
3. If q+1=p, similarly, we have (p,q)=(6,5).
Therefore, (p,q)=(4,4),(5,6),(6,5). □