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.
( 100, 0, 6 ), ( 100, 50, 3 ),
( 150, 0, 9 ), ( 150, 50, 6 ), ( 150, 100, 3 ),
( 200, 0, 12 ), ( 200, 50, 9 ), ( 200, 100, 6 ), ( 200, 150, 3 ),
( 250, 0, 15 ), ( 250, 50, 12 ), ( 250, 100, 9 ), ( 250, 150, 6 ), ( 250, 200, 3 ),
( 300, 0, 18 ), ( 300, 50, 15 ), ( 300, 100, 12 ), ( 300, 150, 9 ), ( 300, 200, 6 ), ( 300, 250, 3 ),
( 350, 0, 21 ), ( 350, 50, 18 ), ( 350, 100, 15 ), ( 350, 150, 12 ), ( 350, 200, 9 ), ( 350, 250, 6 ), ( 350, 300, 3 ),
( 400, 0, 24 ), ( 400, 50, 21 ), ( 400, 100, 18 ), ( 400, 150, 15 ), ( 400, 200, 12 ), ( 400, 250, 9 ), ( 400, 300, 6 ), ( 400, 350, 3 ),
( 450, 0, 27 ), ( 450, 50, 24 ), ( 450, 100, 21 ), ( 450, 150, 18 ), ( 450, 200, 15 ), ( 450, 250, 12 ), ( 450, 300, 9 ), ( 450, 350, 6 ), ( 450, 400, 3 ),
( 500, 0, 30 ), ( 500, 50, 27 ), ( 500, 100, 24 ), ( 500, 150, 21 ), ( 500, 200, 18 ), ( 500, 250, 15 ), ( 500, 300, 12 ), ( 500, 350, 9 ), ( 500, 400, 6 ), ( 500, 450, 3 ),
( 550, 0, 33 ), ( 550, 50, 30 ), ( 550, 100, 27 ), ( 550, 150, 24 ), ( 550, 200, 21 ), ( 550, 250, 18 ), ( 550, 300, 15 ), ( 550, 350, 12 ), ( 550, 400, 9 ), ( 550, 450, 6 ), ( 550, 500, 3 ),
( 600, 0, 36 ), ( 600, 50, 33 ), ( 600, 100, 30 ), ( 600, 150, 27 ), ( 600, 200, 24 ), ( 600, 250, 21 ), ( 600, 300, 18 ), ( 600, 350, 15 ), ( 600, 400, 12 ), ( 600, 450, 9 ), ( 600, 500, 6 ), ( 600, 550, 3 ),
( 650, 0, 39 ), ( 650, 50, 36 ), ( 650, 100, 33 ), ( 650, 150, 30 ), ( 650, 200, 27 ), ( 650, 250, 24 ), ( 650, 300, 21 ), ( 650, 350, 18 ), ( 650, 400, 15 ), ( 650, 450, 12 ), ( 650, 500, 9 ), ( 650, 550, 6 ), ( 650, 600, 3 ),
( 700, 0, 42 ), ( 700, 50, 39 ), ( 700, 100, 36 ), ( 700, 150, 33 ), ( 700, 200, 30 ), ( 700, 250, 27 ), ( 700, 300, 24 ), ( 700, 350, 21 ), ( 700, 400, 18 ), ( 700, 450, 15 ), ( 700, 500, 12 ), ( 700, 550, 9 ), ( 700, 600, 6 ), ( 700, 650, 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 "}"