Given positive integers $m<n\in\mathbb{N}$ is there an algorithm to find integers $z\_1, z\_2\in \mathbb{Z}\setminus\{0\}$ such that $\frac{m}{n}$ is best approximated by $\frac{1}{z\_1}+\frac{1}{z\_2}$? (In other words, the goal is to minimize $|\frac{m}{n}- (\frac{1}{z\_1}+\frac{1}{z\_2})|$.)



Approximation of the form $\frac{1}{u}\pm\frac{1}{v}$
The comments above give a good search algorithm. I wanted to note that the answer can depend very delicately on the exact value. If $\frac{m}{n}=\frac{1}{x}+\frac{1}{y}$ then also $\frac{m}{kn}=\frac{1}{kx}+\frac{1}{ky}$ this allows multiple solutions in some cases. For example all $11$ of these pairs give $\frac{5}{84}:$


$$[7,-12],[12,-42],[14,-84],[15-140],[16,-336],$$$$[17,1428],[18,252],[20,105],[21,84],[24,56],[28,42]$$


For rational (or real) values $r$ close to $\frac{5}{84} \approx 0.059524$ the best approximation (if unique) is likely to come from $[x,y]$ with $5 \le x \le 30$ but small changes in $r$ can cause $x$ to vary up and down.


