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.
( 50, 0, 28 ), ( 50, 25, 14 ),
( 75, 0, 42 ), ( 75, 25, 28 ), ( 75, 50, 14 ),
( 100, 0, 56 ), ( 100, 25, 42 ), ( 100, 50, 28 ), ( 100, 75, 14 ),
( 125, 0, 70 ), ( 125, 25, 56 ), ( 125, 50, 42 ), ( 125, 75, 28 ), ( 125, 100, 14 ),
( 150, 0, 84 ), ( 150, 25, 70 ), ( 150, 50, 56 ), ( 150, 75, 42 ), ( 150, 100, 28 ), ( 150, 125, 14 ),
( 175, 0, 98 ), ( 175, 25, 84 ), ( 175, 50, 70 ), ( 175, 75, 56 ), ( 175, 100, 42 ), ( 175, 125, 28 ), ( 175, 150, 14 ),
( 200, 0, 112 ), ( 200, 25, 98 ), ( 200, 50, 84 ), ( 200, 75, 70 ), ( 200, 100, 56 ), ( 200, 125, 42 ), ( 200, 150, 28 ), ( 200, 175, 14 ),
( 225, 0, 126 ), ( 225, 25, 112 ), ( 225, 50, 98 ), ( 225, 75, 84 ), ( 225, 100, 70 ), ( 225, 125, 56 ), ( 225, 150, 42 ), ( 225, 175, 28 ), ( 225, 200, 14 ),
( 250, 0, 140 ), ( 250, 25, 126 ), ( 250, 50, 112 ), ( 250, 75, 98 ), ( 250, 100, 84 ), ( 250, 125, 70 ), ( 250, 150, 56 ), ( 250, 175, 42 ), ( 250, 200, 28 ), ( 250, 225, 14 ),
( 275, 0, 154 ), ( 275, 25, 140 ), ( 275, 50, 126 ), ( 275, 75, 112 ), ( 275, 100, 98 ), ( 275, 125, 84 ), ( 275, 150, 70 ), ( 275, 175, 56 ), ( 275, 200, 42 ), ( 275, 225, 28 ), ( 275, 250, 14 ),
( 300, 0, 168 ), ( 300, 25, 154 ), ( 300, 50, 140 ), ( 300, 75, 126 ), ( 300, 100, 112 ), ( 300, 125, 98 ), ( 300, 150, 84 ), ( 300, 175, 70 ), ( 300, 200, 56 ), ( 300, 225, 42 ), ( 300, 250, 28 ), ( 300, 275, 14 ),
( 325, 0, 182 ), ( 325, 25, 168 ), ( 325, 50, 154 ), ( 325, 75, 140 ), ( 325, 100, 126 ), ( 325, 125, 112 ), ( 325, 150, 98 ), ( 325, 175, 84 ), ( 325, 200, 70 ), ( 325, 225, 56 ), ( 325, 250, 42 ), ( 325, 275, 28 ), ( 325, 300, 14 ),
( 350, 0, 196 ), ( 350, 25, 182 ), ( 350, 50, 168 ), ( 350, 75, 154 ), ( 350, 100, 140 ), ( 350, 125, 126 ), ( 350, 150, 112 ), ( 350, 175, 98 ), ( 350, 200, 84 ), ( 350, 225, 70 ), ( 350, 250, 56 ), ( 350, 275, 42 ), ( 350, 300, 28 ), ( 350, 325, 14 ),
...
}
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 "}"