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.
( 92, 0, 30 ), ( 92, 46, 15 ),
( 138, 0, 45 ), ( 138, 46, 30 ), ( 138, 92, 15 ),
( 184, 0, 60 ), ( 184, 46, 45 ), ( 184, 92, 30 ), ( 184, 138, 15 ),
( 230, 0, 75 ), ( 230, 46, 60 ), ( 230, 92, 45 ), ( 230, 138, 30 ), ( 230, 184, 15 ),
( 276, 0, 90 ), ( 276, 46, 75 ), ( 276, 92, 60 ), ( 276, 138, 45 ), ( 276, 184, 30 ), ( 276, 230, 15 ),
( 322, 0, 105 ), ( 322, 46, 90 ), ( 322, 92, 75 ), ( 322, 138, 60 ), ( 322, 184, 45 ), ( 322, 230, 30 ), ( 322, 276, 15 ),
( 368, 0, 120 ), ( 368, 46, 105 ), ( 368, 92, 90 ), ( 368, 138, 75 ), ( 368, 184, 60 ), ( 368, 230, 45 ), ( 368, 276, 30 ), ( 368, 322, 15 ),
( 414, 0, 135 ), ( 414, 46, 120 ), ( 414, 92, 105 ), ( 414, 138, 90 ), ( 414, 184, 75 ), ( 414, 230, 60 ), ( 414, 276, 45 ), ( 414, 322, 30 ), ( 414, 368, 15 ),
( 460, 0, 150 ), ( 460, 46, 135 ), ( 460, 92, 120 ), ( 460, 138, 105 ), ( 460, 184, 90 ), ( 460, 230, 75 ), ( 460, 276, 60 ), ( 460, 322, 45 ), ( 460, 368, 30 ), ( 460, 414, 15 ),
( 506, 0, 165 ), ( 506, 46, 150 ), ( 506, 92, 135 ), ( 506, 138, 120 ), ( 506, 184, 105 ), ( 506, 230, 90 ), ( 506, 276, 75 ), ( 506, 322, 60 ), ( 506, 368, 45 ), ( 506, 414, 30 ), ( 506, 460, 15 ),
( 552, 0, 180 ), ( 552, 46, 165 ), ( 552, 92, 150 ), ( 552, 138, 135 ), ( 552, 184, 120 ), ( 552, 230, 105 ), ( 552, 276, 90 ), ( 552, 322, 75 ), ( 552, 368, 60 ), ( 552, 414, 45 ), ( 552, 460, 30 ), ( 552, 506, 15 ),
( 598, 0, 195 ), ( 598, 46, 180 ), ( 598, 92, 165 ), ( 598, 138, 150 ), ( 598, 184, 135 ), ( 598, 230, 120 ), ( 598, 276, 105 ), ( 598, 322, 90 ), ( 598, 368, 75 ), ( 598, 414, 60 ), ( 598, 460, 45 ), ( 598, 506, 30 ), ( 598, 552, 15 ),
( 644, 0, 210 ), ( 644, 46, 195 ), ( 644, 92, 180 ), ( 644, 138, 165 ), ( 644, 184, 150 ), ( 644, 230, 135 ), ( 644, 276, 120 ), ( 644, 322, 105 ), ( 644, 368, 90 ), ( 644, 414, 75 ), ( 644, 460, 60 ), ( 644, 506, 45 ), ( 644, 552, 30 ), ( 644, 598, 15 ),
...
}
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 "}"