It is possible to assign a unique integer value to each irreducible fraction
between 0 and 1. (This shows that there are a countable infinity of fractions.)
The usual way to number them is shown below
1/2 1/3 2/3 1/4 3/4 1/5 2/5 3/5 4/5 1/6 5/6 1/7 ...
Notice that 2/4, for example, does not get listed because it reduces to 1/2.
Given an irreducible fraction we want to find where it appears in the above
counting order, where 1/2 is counted as 1, 1/3 as 2, etc.
Create a class FracCount that contains a method position that is given the numerator
and denominator of an irreducible fraction between 0 and 1 and that returns its
position in the counting order.
|