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.
( 75, 0, 18 ), ( 75, 25, 12 ), ( 75, 50, 6 ),
( 100, 0, 24 ), ( 100, 25, 18 ), ( 100, 50, 12 ), ( 100, 75, 6 ),
( 125, 0, 30 ), ( 125, 25, 24 ), ( 125, 50, 18 ), ( 125, 75, 12 ), ( 125, 100, 6 ),
( 150, 0, 36 ), ( 150, 25, 30 ), ( 150, 50, 24 ), ( 150, 75, 18 ), ( 150, 100, 12 ), ( 150, 125, 6 ),
( 175, 0, 42 ), ( 175, 25, 36 ), ( 175, 50, 30 ), ( 175, 75, 24 ), ( 175, 100, 18 ), ( 175, 125, 12 ), ( 175, 150, 6 ),
( 200, 0, 48 ), ( 200, 25, 42 ), ( 200, 50, 36 ), ( 200, 75, 30 ), ( 200, 100, 24 ), ( 200, 125, 18 ), ( 200, 150, 12 ), ( 200, 175, 6 ),
( 225, 0, 54 ), ( 225, 25, 48 ), ( 225, 50, 42 ), ( 225, 75, 36 ), ( 225, 100, 30 ), ( 225, 125, 24 ), ( 225, 150, 18 ), ( 225, 175, 12 ), ( 225, 200, 6 ),
( 250, 0, 60 ), ( 250, 25, 54 ), ( 250, 50, 48 ), ( 250, 75, 42 ), ( 250, 100, 36 ), ( 250, 125, 30 ), ( 250, 150, 24 ), ( 250, 175, 18 ), ( 250, 200, 12 ), ( 250, 225, 6 ),
( 275, 0, 66 ), ( 275, 25, 60 ), ( 275, 50, 54 ), ( 275, 75, 48 ), ( 275, 100, 42 ), ( 275, 125, 36 ), ( 275, 150, 30 ), ( 275, 175, 24 ), ( 275, 200, 18 ), ( 275, 225, 12 ), ( 275, 250, 6 ),
( 300, 0, 72 ), ( 300, 25, 66 ), ( 300, 50, 60 ), ( 300, 75, 54 ), ( 300, 100, 48 ), ( 300, 125, 42 ), ( 300, 150, 36 ), ( 300, 175, 30 ), ( 300, 200, 24 ), ( 300, 225, 18 ), ( 300, 250, 12 ), ( 300, 275, 6 ),
( 325, 0, 78 ), ( 325, 25, 72 ), ( 325, 50, 66 ), ( 325, 75, 60 ), ( 325, 100, 54 ), ( 325, 125, 48 ), ( 325, 150, 42 ), ( 325, 175, 36 ), ( 325, 200, 30 ), ( 325, 225, 24 ), ( 325, 250, 18 ), ( 325, 275, 12 ), ( 325, 300, 6 ),
( 350, 0, 84 ), ( 350, 25, 78 ), ( 350, 50, 72 ), ( 350, 75, 66 ), ( 350, 100, 60 ), ( 350, 125, 54 ), ( 350, 150, 48 ), ( 350, 175, 42 ), ( 350, 200, 36 ), ( 350, 225, 30 ), ( 350, 250, 24 ), ( 350, 275, 18 ), ( 350, 300, 12 ), ( 350, 325, 6 ),
...
}
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 "}"