One way to define a rational number (a-b)/c is to define it as the (infinite) set of all 3-tuples of natural numbers (a1, b1, c1) for which (a-b)/c = (a1-b1)/c1 (b is needed for negative numbers).
Klick on a 3-tuple to see how it may be defined as a set.
( 88, 0, 50 ), ( 88, 44, 25 ),
( 132, 0, 75 ), ( 132, 44, 50 ), ( 132, 88, 25 ),
( 176, 0, 100 ), ( 176, 44, 75 ), ( 176, 88, 50 ), ( 176, 132, 25 ),
( 220, 0, 125 ), ( 220, 44, 100 ), ( 220, 88, 75 ), ( 220, 132, 50 ), ( 220, 176, 25 ),
( 264, 0, 150 ), ( 264, 44, 125 ), ( 264, 88, 100 ), ( 264, 132, 75 ), ( 264, 176, 50 ), ( 264, 220, 25 ),
( 308, 0, 175 ), ( 308, 44, 150 ), ( 308, 88, 125 ), ( 308, 132, 100 ), ( 308, 176, 75 ), ( 308, 220, 50 ), ( 308, 264, 25 ),
( 352, 0, 200 ), ( 352, 44, 175 ), ( 352, 88, 150 ), ( 352, 132, 125 ), ( 352, 176, 100 ), ( 352, 220, 75 ), ( 352, 264, 50 ), ( 352, 308, 25 ),
( 396, 0, 225 ), ( 396, 44, 200 ), ( 396, 88, 175 ), ( 396, 132, 150 ), ( 396, 176, 125 ), ( 396, 220, 100 ), ( 396, 264, 75 ), ( 396, 308, 50 ), ( 396, 352, 25 ),
( 440, 0, 250 ), ( 440, 44, 225 ), ( 440, 88, 200 ), ( 440, 132, 175 ), ( 440, 176, 150 ), ( 440, 220, 125 ), ( 440, 264, 100 ), ( 440, 308, 75 ), ( 440, 352, 50 ), ( 440, 396, 25 ),
( 484, 0, 275 ), ( 484, 44, 250 ), ( 484, 88, 225 ), ( 484, 132, 200 ), ( 484, 176, 175 ), ( 484, 220, 150 ), ( 484, 264, 125 ), ( 484, 308, 100 ), ( 484, 352, 75 ), ( 484, 396, 50 ), ( 484, 440, 25 ),
( 528, 0, 300 ), ( 528, 44, 275 ), ( 528, 88, 250 ), ( 528, 132, 225 ), ( 528, 176, 200 ), ( 528, 220, 175 ), ( 528, 264, 150 ), ( 528, 308, 125 ), ( 528, 352, 100 ), ( 528, 396, 75 ), ( 528, 440, 50 ), ( 528, 484, 25 ),
( 572, 0, 325 ), ( 572, 44, 300 ), ( 572, 88, 275 ), ( 572, 132, 250 ), ( 572, 176, 225 ), ( 572, 220, 200 ), ( 572, 264, 175 ), ( 572, 308, 150 ), ( 572, 352, 125 ), ( 572, 396, 100 ), ( 572, 440, 75 ), ( 572, 484, 50 ), ( 572, 528, 25 ),
( 616, 0, 350 ), ( 616, 44, 325 ), ( 616, 88, 300 ), ( 616, 132, 275 ), ( 616, 176, 250 ), ( 616, 220, 225 ), ( 616, 264, 200 ), ( 616, 308, 175 ), ( 616, 352, 150 ), ( 616, 396, 125 ), ( 616, 440, 100 ), ( 616, 484, 75 ), ( 616, 528, 50 ), ( 616, 572, 25 ),
...
}
The equation (a-b)/c = (a1-b1)/c1 is equivalent to a·c1 + b1·c = a1·c + b·c1 - so only addition and multiplication of natural numbers are needed to define the rational numbers.
For rational numbers Q, Q1 as defined above, Q < Q1 is defined as a·c1 + b1·c < a1·c + b·c1 for one/all (a, b, c) ∈ Q, (a1, b1, c1) ∈ Q1.
Q + Q1 is defined as (a2-b2)/c2, where a2 = a·c1 + a1·c, b2 = b·c1 + b1·c, c2 = c·c1 for one/all (a, b, c) ∈ Q, (a1, b1, c1) ∈ Q1.
Be aware that (a2-b2)/c2 is simply a notation for the set determined by a2, b2 and c2 here - not an expression using subtraction and division.
The definition for Q + Q1 above simply is a transformation of the expression (a-b)/c + (a1-b1)/c1.
Assuming that a,c is minimal for a positive rational number a/c or (a-0)/c, we can enumerate all members of the set by doing this:
Let n be 1 Repeat: For all n1 from 0 to n-1: Let a1 be n·a Let b1 be n1·a Let c1 be (n-n1)·c Enumerate (a1,b1,c1) Increase n by 1
The enumeration as Python function with a limiting parameter k which will cause the function to enumerate (k·(k+1))/2 elements of a/c:
def print_rational_number(a,c,k): print str(a)+'/'+str(c)+' = ('+str(a)+'-0)/'+str(c)+' = {' for n in range(1,k+1): for n1 in range(n): a1=n*a b1=n1*a c1=(n-n1)*c print '( '+str(a1)+', '+str(b1)+', '+str(c1)+' ),' print print "..." print "}"