Let $x$ and $y$ be positive reals in $(0,1)$ with $x < y$ and $y-x =\epsilon$. I seek smallest primes $p$ and $q$ such that $$x \le \frac{p}{q} \le (x+\epsilon) = y \;.$$
Q. What upper bound $u(\epsilon)$ can be placed on $\max\{p,q\}=\max(q)$ as a function of $\epsilon$?
Examples.
$x=\sqrt{2}/2 \approx 0.707107$, $\epsilon=10^{-4}$, $y=(x+\epsilon)$, then $$ x = \sqrt{2}/2 \approx 0.\color{blue}{707}{\color{red}{1}}07 < \frac{p}{q}=\frac{1217}{1721}\approx 0.\color{blue}{707}147 < 0.\color{blue}{707}{\color{red}{2}}07 \approx (\sqrt{2}/2 + \epsilon) = y \;. $$ For $\epsilon=10^{-5}$, $$ x = \sqrt{2}/2 \approx 0.\color{blue}{7071}\color{red}{0}7 < \frac{p}{q}=\frac{3491}{4937}\approx 0.\color{blue}{7071}096 < 0.\color{blue}{7071}{\color{red}{1}}7 \approx (\sqrt{2}/2 + \epsilon) = y \;. $$ I believe those are optimal prime ratios for those $x$ & $y$. If so, $u(10^{-4}) \ge 1721$ and $u(10^{-5}) \ge 4973$; and $u(10^{-6}) \ge 8597$ and $u(10^{-7}) \ge 38287$ (data not presented): $$ \begin{array}{cccc} \epsilon=10^{-4} & \epsilon=10^{-5} & \epsilon=10^{-6} & \epsilon=10^{-7}\\ u(\epsilon) \ge 1721 & u(\epsilon)\ge 4937 & u(\epsilon)\ge 8597 & u(\epsilon)\ge 38287 \end{array} $$
(The above question is tangentially related to the earlier question, "Visibility in a prime orchard.")