Denote by A={an∣n=1,2,…} and B={bn∣n=1,2,…}. Let us assume P and Q are non-constant. Otherwise all the pairs (a,b) would be the solution. We claim that if logbloga∈Q then a,b satisfies the problem's condition. If logbloga=sr where r,s are even integers, let P(x)=xr,Q(x)=xs then, P(t)∈A if and only if tr=an thus, ts=bn, yielding Q(t)∈B.
Now, if logbloga is irrational but there are polynomials P,Q then there must exist M such that P(x),Q(x) are strictly increasing on [M,+∞). If t>M satisfies the statement of the problem, then P(t)=an for some positive integer n and Q(t)=bm for some positive integer m. Thus, there would be t1>t such that P(t1)=an+1 and then Q(t1)=bm+N. If N>1 then there is some z such that Q(z)=bm+1 and hence, P(z) must be a power of a between an,an+1, a contradiction. Hence, N=1.
Analogously, we obtain a sequence (tk) such that P(tk)=an+k as well as P(tk)=bm+k. Notice that limx→+∞logQ(x)logP(x)=degQdegP. Then,
logbloga=k→+∞limlogbm+klogan+k=tk→+∞limlogQ(tk)logP(tk)=degQdegP.
Remark. It is clear that tk tends to infinity and also P and Q would be positive for all large enough x. ■