Consider a certain rational number $\alpha=m/n$ and let $N$ be a positive integer. Is there a way to find the better rational approximation $x/y$ of $\alpha$ between all the fraction such that $xy=N,$ with $x,y$ not necessarily coprime? I have an intuitive idea, but this is not really useful if $N$ is big and I’m not even sure it works correctly in general.
I explain this idea with a concrete example.
Suppose $\alpha=3/8$ and let $N=20=2^2\cdot 5.$ The “exact” condition $x/y=3/8$ means that there exist an integer $u$ such that $x=3u,y=8u.$ Using $xy=20$ I find that the exact condition is realised when $u=\sqrt{5/6}.$ Then $y=8\sqrt{5/6}\sim 7.3$ If I want the better approximation with my constraint I should get $y$ the closest divisor of $20$ to $7.3$ from above and below, which are $10$ and $5.$ The corresponding approximation are $4/5$ and $2/10$ and from an easy check we see that $2/10$ is the better approximation.
This strategy may have a huge problem when $N$ is huge: in particular when its factorisation is unknown or when it has a lot of divisors. Is there a way to treat this problem rather easily? I know that there are some strategies using the truncation of the continued fractions, but the constraint on the product seems to be not good to be dealt in this way.
For instance, how can I solve the problem when $N=15!$ and $\alpha=19/37$?
$xy=15!=N$. $Ny^{-2}=x/y\approx19/37$. $y\approx\sqrt{37N/19}\approx1595783$. So we want a divisor of $15!$ close to $1595783$.
$15!=2^{11}3^65^37^211\cdot13$. Taking logs, we want $a_2\log2+a_3\log3+a_5\log5+a_7\log7+a_{11}\log11+a_{13}\log13\approx\log1595783$ with $0\le a_2\le11$, $0\le a_3\le6$, ..., $0\le a_{13}\le1$. This is an integer programming problem. There are efficient techniques for finding solutions (but I don't know them well enough to go into any detail). Certainly there are integer-relation finding algorithms like PSLQ that could be brought to bear. See, for a start, https://en.wikipedia.org/wiki/Integer_relation_algorithm