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, 26 ), ( 88, 44, 13 ),
( 132, 0, 39 ), ( 132, 44, 26 ), ( 132, 88, 13 ),
( 176, 0, 52 ), ( 176, 44, 39 ), ( 176, 88, 26 ), ( 176, 132, 13 ),
( 220, 0, 65 ), ( 220, 44, 52 ), ( 220, 88, 39 ), ( 220, 132, 26 ), ( 220, 176, 13 ),
( 264, 0, 78 ), ( 264, 44, 65 ), ( 264, 88, 52 ), ( 264, 132, 39 ), ( 264, 176, 26 ), ( 264, 220, 13 ),
( 308, 0, 91 ), ( 308, 44, 78 ), ( 308, 88, 65 ), ( 308, 132, 52 ), ( 308, 176, 39 ), ( 308, 220, 26 ), ( 308, 264, 13 ),
( 352, 0, 104 ), ( 352, 44, 91 ), ( 352, 88, 78 ), ( 352, 132, 65 ), ( 352, 176, 52 ), ( 352, 220, 39 ), ( 352, 264, 26 ), ( 352, 308, 13 ),
( 396, 0, 117 ), ( 396, 44, 104 ), ( 396, 88, 91 ), ( 396, 132, 78 ), ( 396, 176, 65 ), ( 396, 220, 52 ), ( 396, 264, 39 ), ( 396, 308, 26 ), ( 396, 352, 13 ),
( 440, 0, 130 ), ( 440, 44, 117 ), ( 440, 88, 104 ), ( 440, 132, 91 ), ( 440, 176, 78 ), ( 440, 220, 65 ), ( 440, 264, 52 ), ( 440, 308, 39 ), ( 440, 352, 26 ), ( 440, 396, 13 ),
( 484, 0, 143 ), ( 484, 44, 130 ), ( 484, 88, 117 ), ( 484, 132, 104 ), ( 484, 176, 91 ), ( 484, 220, 78 ), ( 484, 264, 65 ), ( 484, 308, 52 ), ( 484, 352, 39 ), ( 484, 396, 26 ), ( 484, 440, 13 ),
( 528, 0, 156 ), ( 528, 44, 143 ), ( 528, 88, 130 ), ( 528, 132, 117 ), ( 528, 176, 104 ), ( 528, 220, 91 ), ( 528, 264, 78 ), ( 528, 308, 65 ), ( 528, 352, 52 ), ( 528, 396, 39 ), ( 528, 440, 26 ), ( 528, 484, 13 ),
( 572, 0, 169 ), ( 572, 44, 156 ), ( 572, 88, 143 ), ( 572, 132, 130 ), ( 572, 176, 117 ), ( 572, 220, 104 ), ( 572, 264, 91 ), ( 572, 308, 78 ), ( 572, 352, 65 ), ( 572, 396, 52 ), ( 572, 440, 39 ), ( 572, 484, 26 ), ( 572, 528, 13 ),
( 616, 0, 182 ), ( 616, 44, 169 ), ( 616, 88, 156 ), ( 616, 132, 143 ), ( 616, 176, 130 ), ( 616, 220, 117 ), ( 616, 264, 104 ), ( 616, 308, 91 ), ( 616, 352, 78 ), ( 616, 396, 65 ), ( 616, 440, 52 ), ( 616, 484, 39 ), ( 616, 528, 26 ), ( 616, 572, 13 ),
...
}
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 "}"