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, 24 ), ( 75, 25, 16 ), ( 75, 50, 8 ),
( 100, 0, 32 ), ( 100, 25, 24 ), ( 100, 50, 16 ), ( 100, 75, 8 ),
( 125, 0, 40 ), ( 125, 25, 32 ), ( 125, 50, 24 ), ( 125, 75, 16 ), ( 125, 100, 8 ),
( 150, 0, 48 ), ( 150, 25, 40 ), ( 150, 50, 32 ), ( 150, 75, 24 ), ( 150, 100, 16 ), ( 150, 125, 8 ),
( 175, 0, 56 ), ( 175, 25, 48 ), ( 175, 50, 40 ), ( 175, 75, 32 ), ( 175, 100, 24 ), ( 175, 125, 16 ), ( 175, 150, 8 ),
( 200, 0, 64 ), ( 200, 25, 56 ), ( 200, 50, 48 ), ( 200, 75, 40 ), ( 200, 100, 32 ), ( 200, 125, 24 ), ( 200, 150, 16 ), ( 200, 175, 8 ),
( 225, 0, 72 ), ( 225, 25, 64 ), ( 225, 50, 56 ), ( 225, 75, 48 ), ( 225, 100, 40 ), ( 225, 125, 32 ), ( 225, 150, 24 ), ( 225, 175, 16 ), ( 225, 200, 8 ),
( 250, 0, 80 ), ( 250, 25, 72 ), ( 250, 50, 64 ), ( 250, 75, 56 ), ( 250, 100, 48 ), ( 250, 125, 40 ), ( 250, 150, 32 ), ( 250, 175, 24 ), ( 250, 200, 16 ), ( 250, 225, 8 ),
( 275, 0, 88 ), ( 275, 25, 80 ), ( 275, 50, 72 ), ( 275, 75, 64 ), ( 275, 100, 56 ), ( 275, 125, 48 ), ( 275, 150, 40 ), ( 275, 175, 32 ), ( 275, 200, 24 ), ( 275, 225, 16 ), ( 275, 250, 8 ),
( 300, 0, 96 ), ( 300, 25, 88 ), ( 300, 50, 80 ), ( 300, 75, 72 ), ( 300, 100, 64 ), ( 300, 125, 56 ), ( 300, 150, 48 ), ( 300, 175, 40 ), ( 300, 200, 32 ), ( 300, 225, 24 ), ( 300, 250, 16 ), ( 300, 275, 8 ),
( 325, 0, 104 ), ( 325, 25, 96 ), ( 325, 50, 88 ), ( 325, 75, 80 ), ( 325, 100, 72 ), ( 325, 125, 64 ), ( 325, 150, 56 ), ( 325, 175, 48 ), ( 325, 200, 40 ), ( 325, 225, 32 ), ( 325, 250, 24 ), ( 325, 275, 16 ), ( 325, 300, 8 ),
( 350, 0, 112 ), ( 350, 25, 104 ), ( 350, 50, 96 ), ( 350, 75, 88 ), ( 350, 100, 80 ), ( 350, 125, 72 ), ( 350, 150, 64 ), ( 350, 175, 56 ), ( 350, 200, 48 ), ( 350, 225, 40 ), ( 350, 250, 32 ), ( 350, 275, 24 ), ( 350, 300, 16 ), ( 350, 325, 8 ),
...
}
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 "}"