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.
( 69, 0, 9 ), ( 69, 23, 6 ), ( 69, 46, 3 ),
( 92, 0, 12 ), ( 92, 23, 9 ), ( 92, 46, 6 ), ( 92, 69, 3 ),
( 115, 0, 15 ), ( 115, 23, 12 ), ( 115, 46, 9 ), ( 115, 69, 6 ), ( 115, 92, 3 ),
( 138, 0, 18 ), ( 138, 23, 15 ), ( 138, 46, 12 ), ( 138, 69, 9 ), ( 138, 92, 6 ), ( 138, 115, 3 ),
( 161, 0, 21 ), ( 161, 23, 18 ), ( 161, 46, 15 ), ( 161, 69, 12 ), ( 161, 92, 9 ), ( 161, 115, 6 ), ( 161, 138, 3 ),
( 184, 0, 24 ), ( 184, 23, 21 ), ( 184, 46, 18 ), ( 184, 69, 15 ), ( 184, 92, 12 ), ( 184, 115, 9 ), ( 184, 138, 6 ), ( 184, 161, 3 ),
( 207, 0, 27 ), ( 207, 23, 24 ), ( 207, 46, 21 ), ( 207, 69, 18 ), ( 207, 92, 15 ), ( 207, 115, 12 ), ( 207, 138, 9 ), ( 207, 161, 6 ), ( 207, 184, 3 ),
( 230, 0, 30 ), ( 230, 23, 27 ), ( 230, 46, 24 ), ( 230, 69, 21 ), ( 230, 92, 18 ), ( 230, 115, 15 ), ( 230, 138, 12 ), ( 230, 161, 9 ), ( 230, 184, 6 ), ( 230, 207, 3 ),
( 253, 0, 33 ), ( 253, 23, 30 ), ( 253, 46, 27 ), ( 253, 69, 24 ), ( 253, 92, 21 ), ( 253, 115, 18 ), ( 253, 138, 15 ), ( 253, 161, 12 ), ( 253, 184, 9 ), ( 253, 207, 6 ), ( 253, 230, 3 ),
( 276, 0, 36 ), ( 276, 23, 33 ), ( 276, 46, 30 ), ( 276, 69, 27 ), ( 276, 92, 24 ), ( 276, 115, 21 ), ( 276, 138, 18 ), ( 276, 161, 15 ), ( 276, 184, 12 ), ( 276, 207, 9 ), ( 276, 230, 6 ), ( 276, 253, 3 ),
( 299, 0, 39 ), ( 299, 23, 36 ), ( 299, 46, 33 ), ( 299, 69, 30 ), ( 299, 92, 27 ), ( 299, 115, 24 ), ( 299, 138, 21 ), ( 299, 161, 18 ), ( 299, 184, 15 ), ( 299, 207, 12 ), ( 299, 230, 9 ), ( 299, 253, 6 ), ( 299, 276, 3 ),
( 322, 0, 42 ), ( 322, 23, 39 ), ( 322, 46, 36 ), ( 322, 69, 33 ), ( 322, 92, 30 ), ( 322, 115, 27 ), ( 322, 138, 24 ), ( 322, 161, 21 ), ( 322, 184, 18 ), ( 322, 207, 15 ), ( 322, 230, 12 ), ( 322, 253, 9 ), ( 322, 276, 6 ), ( 322, 299, 3 ),
...
}
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 "}"