We prove that there is no such function. For arbitrary elements a and b of S, choose an integer c that is greater than both of them. Since bc>a and c>b, we have
f(a4b4c4)=f(a2)f(b2c2)=f(a2)f(b)f(c)
Furthermore, since ac>b and c>a, we have
f(a4b4c4)=f(b2)f(a2c2)=f(b2)f(a)f(c)
Comparing these two equations, we find that for all elements a and b of S,
f(a2)f(b)=f(b2)f(a)⟹f(a)f(a2)=f(b)f(b2)
It follows that there exists a positive rational number k such that
f(a2)=kf(a), for all a∈S.(1)
Substituting this into the functional equation yields
f(ab)=kf(a)f(b), for all a,b∈S with a=b.(2)
Now combine the functional equation with equations (1) and (2) to obtain
f(a)f(a2)=f(a6)=kf(a)f(a5)=k2f(a)f(a)f(a4)=kf(a)f(a)f(a2), for all a∈S.
It follows that f(a)=k for all a∈S. Substituting a=2 and b=3 into the functional equation yields k=1, however 1∈/S and hence we have no solutions.