Question:
Given positive integers $p$, $q$ and $r$ with $p=3^q\cdot2^r$ and $100<p<1000$. The difference between maximum and minimum values of $(q+r)$, is _______.
My Approach:
As we are given that $100<p<1000$, on taking logarithm to the base $10$, we get:
$$\log100<\log p<\log 1000$$
$$2<\log(3^q\cdot2^r)<3$$
$$2<q\log 3+r\log 2<3$$
$$2<q(0.4771)+r(0.3010)<3$$
The only way I could think of to obtain the maximum and minimum values of $q$ and $r$ is to substitute them with natural numbers and look when the condition is satisfied. Is there any formal approach (other than substituting $q$ and $r$ with natural numbers) using which we can find the minimum and maximum values of $(q+r)$? If yes, it would be helpful if you could explain it.
On substituting different values of $q$ and $r$ in the condition arrived, the minimum and maximum values of $(q+r)$ comes out to be $5$ and $9$ respectively. And the answer to the above question is thus $9-5=4$. This is also the correct answer with respect to the answer key provided in my book.
The answer is quite straightforward if you draw the lines \begin{align*} \frac q{\frac 2{\log 3}}+\frac r{\frac 2{\log 2}}&=1\Rightarrow \frac q{4.\cdots}+\frac r{6.6\cdots}=1\tag{1}\\ \frac q{\frac 3{\log 3}}+\frac r{\frac 3{\log 2}}&=1\Rightarrow \frac q{6.\cdots}+\frac r{9.9\cdots}=1\tag{2}\\ q+r&=10\tag{3}\\ q+r&=4\tag{4}\\ \end{align*} on $q-r$ axes neatly and see that the points $(5,0)$ and $(0,9)$ can serve the best values $5$ and $9$ respectively, for the points lie strictly in the region between the lines $(1)$ and $(2)$ (let us call it region R). Lines $(3)$ and $(4)$ are drawn just to see that the best values can't be outside what we have obtained, that is $q+r$ can't be $4,10$.
EDIT:
But since $q,r\in \mathbb N$, we need to take positive integral points or points in which both $q,r\in\mathbb N$. I think the best approach would be to see that at least some segment of the lines $q+r=5$ and $q+r=9$ lies inside the region R, and then to make sure that those segments have positive integral points on them. For example, take the points $(4,1)$ and $(1,8)$. If they don't suffice(Well, they do here. I am just trying to provide an algorithmic approach to solve bigger such problems.), keep taking points from the segments of the lines $q+r=5$ and $q+r=9$. If they all don't suffice, move to lines that lie more inside the region R. For example, $q+r=4$ and $q+r=8$.
Note that the positive integral points nearest to the lines $(1)$ and $(2)$ will give the limits nearest to $100$ and $1000$. One can apply the "distance from a line" formula if the distances of two such points from the lines $(1)$ and $(2)$ are to be compared, and the inequality is not apparent by the neat plot.