Take the 2-minute tour ×

What could be the fastest manual approach for sorting (ascending) these fractions:


I would also be very grateful if somebody explain a general manual approach for sorting fractions which doesn't really follow any pattern.

share|improve this question
add comment

4 Answers

up vote 14 down vote accepted

The fastest way is to use lazy continued fraction expansions, computed in parallel, as I explained in an answer to a similar question. Your example requires only a single step manually, viz.

$$ 2-\dfrac{5}{117}\ <\ 2-\dfrac{5}{123}\ <\ 2+\dfrac{5}{5\cdot109}\ <\ 2+\dfrac{5}{143} $$

share|improve this answer
+1: They should be teaching this in grade school/junior high (and get rid of the calculators). –  Jyrki Lahtonen Aug 17 '11 at 12:32
@Bill Dubuque:I do understand your approach but as I had never tried converting rationals into continued fractions before,I am facing some troubles in understanding that process,precisely when the rational is less than $1$ for the converse i am using extended Euclid theorem. –  Quixotic Aug 17 '11 at 20:15
@Foo See the Wikipedia page for an intro to CFs. But you don't need to know anything about CFs to understand the algorithm in the my linked answer. See my discussion there. –  Bill Dubuque Aug 17 '11 at 20:29
I think I understood the algorithm,but don't we need to convert to that form before comparing? –  Quixotic Aug 17 '11 at 20:32
The algorithm does not take CFs as input. Rather it works on any effective representation of rationals or reals, i.e. where one can effectively compute the operations: floor, sgn, x-n, and 1/x. Conceptually the algorithm computes and compares the continued fraction coefficients. But if you aren't familiar with CFs you can simply ignore that background information and simply view it as comparing integer and fractional parts, performing the latter by flipping and recursing, as described in the linked answer. –  Bill Dubuque Aug 17 '11 at 20:45
add comment

The answer by lhf is the only real way (other than the elegant approach described by Bill Dubuque). You can use some ad hoc techniques to makes the numbers smaller. One possible trick is that for positive integers $a,b,c,d$ we always have that the mediant $(a+c)/(b+d)$ is between $a/b$ and $c/d$. Works here. The mediant of the first two is $260/520=1/2$, so to compare these two you only need to decide, which is larger than $1/2$, and that is easier with lhf's test (= the definition of the order of rationals).

A weighted mediant might work better sometimes, but occasionally you just cannot avoid getting some dirt on your hands.

share|improve this answer
add comment

The only way I know of comparing fractions without considering decimal equivalents is by cross multiplication: $\displaystyle\frac a b < \frac c d $ iff $ad < bc$ (assuming positive fractions).

share|improve this answer
I knew this method,but this is really very very very slow here. –  Quixotic Aug 17 '11 at 10:52
@FoolForMath: plus the least decimal equivalents that you need for comparision are $0.5109,0.491,0.5103,0.497$. –  lhf Aug 17 '11 at 11:07
add comment

First, note that $$ \frac{{117}}{{229}},\;\frac{{123}}{{241}} > \frac{1}{2} $$ and $$ \frac{{143}}{{291}},\;\frac{{109}}{{219}} < \frac{1}{2}. $$ Hence it suffices to show $$ \frac{{117}}{{229}} > \frac{{123}}{{241}} $$ and $$ \frac{{143}}{{291}} < \frac{{109}}{{219}}. $$ For the first inequality, note that $$ \frac{{123}}{{241}} = \frac{{117 + 6}}{{229 + 12}} < \frac{{117}}{{229}}, $$ since $$ \frac{6}{{12}} = \frac{1}{2} < \frac{{117}}{{229}}. $$ For the second inequality, note that $$ \frac{{143}}{{291}} = \frac{{109 + 34}}{{219 + 72}} < \frac{{109}}{{219}}, $$ since $$ \frac{{34}}{{72}} < \frac{{109}}{{219}}. $$ (The last inequality can be taken for granted, noting that $109/219 \approx 0.5$.)

share|improve this answer
add comment

Your Answer


