Approximating a rational number in a subset of Q defined by limited prime factors

35 Views Asked by At

I'm wondering if there is an efficient (or good enough for small numbers) algorithm for the following problem:

Suppose I have a rational number in the form of its prime factorization:

$k = p_0^{x_0}p_1^{x_1}...p_n^{x_n}$ with $x_i \in \mathbb{Z}$

In regards to a subset $L \subset \mathbb{Q}$ defined by all numbers of the form

$k' = p_0^{x_0}p_1^{x_1}...p_m^{x_m}$ for a fixed $m$

find for any $k \in \mathbb{Q}$ a number $k' \in L$ so that $|k-k'|$ is minimized.

It can be assumed that $k$ is already given in the above form and does not need to be factorized first.