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, 21 ), ( 75, 25, 14 ), ( 75, 50, 7 ),
( 100, 0, 28 ), ( 100, 25, 21 ), ( 100, 50, 14 ), ( 100, 75, 7 ),
( 125, 0, 35 ), ( 125, 25, 28 ), ( 125, 50, 21 ), ( 125, 75, 14 ), ( 125, 100, 7 ),
( 150, 0, 42 ), ( 150, 25, 35 ), ( 150, 50, 28 ), ( 150, 75, 21 ), ( 150, 100, 14 ), ( 150, 125, 7 ),
( 175, 0, 49 ), ( 175, 25, 42 ), ( 175, 50, 35 ), ( 175, 75, 28 ), ( 175, 100, 21 ), ( 175, 125, 14 ), ( 175, 150, 7 ),
( 200, 0, 56 ), ( 200, 25, 49 ), ( 200, 50, 42 ), ( 200, 75, 35 ), ( 200, 100, 28 ), ( 200, 125, 21 ), ( 200, 150, 14 ), ( 200, 175, 7 ),
( 225, 0, 63 ), ( 225, 25, 56 ), ( 225, 50, 49 ), ( 225, 75, 42 ), ( 225, 100, 35 ), ( 225, 125, 28 ), ( 225, 150, 21 ), ( 225, 175, 14 ), ( 225, 200, 7 ),
( 250, 0, 70 ), ( 250, 25, 63 ), ( 250, 50, 56 ), ( 250, 75, 49 ), ( 250, 100, 42 ), ( 250, 125, 35 ), ( 250, 150, 28 ), ( 250, 175, 21 ), ( 250, 200, 14 ), ( 250, 225, 7 ),
( 275, 0, 77 ), ( 275, 25, 70 ), ( 275, 50, 63 ), ( 275, 75, 56 ), ( 275, 100, 49 ), ( 275, 125, 42 ), ( 275, 150, 35 ), ( 275, 175, 28 ), ( 275, 200, 21 ), ( 275, 225, 14 ), ( 275, 250, 7 ),
( 300, 0, 84 ), ( 300, 25, 77 ), ( 300, 50, 70 ), ( 300, 75, 63 ), ( 300, 100, 56 ), ( 300, 125, 49 ), ( 300, 150, 42 ), ( 300, 175, 35 ), ( 300, 200, 28 ), ( 300, 225, 21 ), ( 300, 250, 14 ), ( 300, 275, 7 ),
( 325, 0, 91 ), ( 325, 25, 84 ), ( 325, 50, 77 ), ( 325, 75, 70 ), ( 325, 100, 63 ), ( 325, 125, 56 ), ( 325, 150, 49 ), ( 325, 175, 42 ), ( 325, 200, 35 ), ( 325, 225, 28 ), ( 325, 250, 21 ), ( 325, 275, 14 ), ( 325, 300, 7 ),
( 350, 0, 98 ), ( 350, 25, 91 ), ( 350, 50, 84 ), ( 350, 75, 77 ), ( 350, 100, 70 ), ( 350, 125, 63 ), ( 350, 150, 56 ), ( 350, 175, 49 ), ( 350, 200, 42 ), ( 350, 225, 35 ), ( 350, 250, 28 ), ( 350, 275, 21 ), ( 350, 300, 14 ), ( 350, 325, 7 ),
...
}
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 "}"