TITLE: Reduce precision of fraction
QUESTION [8 upvotes]: Say I have a reduced fraction where the numerator and denominator can only be integers:
$$ \frac{1071283}{28187739} $$
and I want to reduce it more, accepting the lose of precision.
I could just remove an equal numbers of integers from the right:
$$ \frac{107}{2818} $$
However playing around with it shows me that I can easily find a fraction that contains the same number of integers but has lost less precision compared to the original fraction:
$$ \frac{108}{2842} $$
How can I reduce a fraction of integers and lose the minimal amount of precision?

REPLY [5 votes]: The Stern-Brocot Tree gives a sequence of best rational approximations to a number in the sense that if $a/b$ is a rational approximation to $x$ which is not in the sequence, then the sequence contains a closer approximation to $x$ which has a denominator at most equal to $b$.  The Stern-Brocot sequence includes the continued fraction convergents so it is in a sense more general; you have more choices.  In the case of $1071283/28187739$, the sequence consists of $72$ numbers. The Wikipedia article includes an algorithm for generating this sequence.
$$\left\{1,\frac{1}{2},\frac{1}{3},\frac{1}{4},\frac{1}{5},\frac{1}{6},\frac{1}{7},\frac{1}{8}
   ,\frac{1}{9},\frac{1}{10},\frac{1}{11},\frac{1}{12},\frac{1}{13},\frac{1}{14},\frac{1}{15
   },\frac{1}{16},\frac{1}{17},\frac{1}{18},\frac{1}{19},\frac{1}{20},\frac{1}{21},\frac{1}{
   22},\frac{1}{23},\frac{1}{24},\frac{1}{25},\frac{1}{26},\frac{1}{27},\frac{2}{53},\frac{3
   }{79},\frac{4}{105},\frac{7}{184},\frac{10}{263},\frac{13}{342},\frac{16}{421},\frac{29}{
   763},\frac{45}{1184},\frac{61}{1605},\frac{77}{2026},\frac{93}{2447},\frac{109}{2868},\frac{125}{3289},\frac{141}{3710},\frac{157}{4131},\frac{173}{4552},\frac{330}{8683},\frac{5
   03}{13235},\frac{676}{17787},\frac{849}{22339},\frac{1525}{40126},\frac{2374}{62465},\frac{3899}{102591},\frac{6273}{165056},\frac{10172}{267647},\frac{16445}{432703},\frac{26617
   }{700350},\frac{36789}{967997},\frac{46961}{1235644},\frac{57133}{1503291},\frac{67305}{1
   770938},\frac{77477}{2038585},\frac{87649}{2306232},\frac{97821}{2573879},\frac{107993}{2
   841526},\frac{118165}{3109173},\frac{128337}{3376820},\frac{138509}{3644467},\frac{148681
   }{3912114},\frac{158853}{4179761},\frac{307534}{8091875},\frac{456215}{12003989},\frac{76
   3749}{20095864},\frac{1071283}{28187739}\right\}
$$