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, 14 ), ( 100, 50, 7 ),
( 150, 0, 21 ), ( 150, 50, 14 ), ( 150, 100, 7 ),
( 200, 0, 28 ), ( 200, 50, 21 ), ( 200, 100, 14 ), ( 200, 150, 7 ),
( 250, 0, 35 ), ( 250, 50, 28 ), ( 250, 100, 21 ), ( 250, 150, 14 ), ( 250, 200, 7 ),
( 300, 0, 42 ), ( 300, 50, 35 ), ( 300, 100, 28 ), ( 300, 150, 21 ), ( 300, 200, 14 ), ( 300, 250, 7 ),
( 350, 0, 49 ), ( 350, 50, 42 ), ( 350, 100, 35 ), ( 350, 150, 28 ), ( 350, 200, 21 ), ( 350, 250, 14 ), ( 350, 300, 7 ),
( 400, 0, 56 ), ( 400, 50, 49 ), ( 400, 100, 42 ), ( 400, 150, 35 ), ( 400, 200, 28 ), ( 400, 250, 21 ), ( 400, 300, 14 ), ( 400, 350, 7 ),
( 450, 0, 63 ), ( 450, 50, 56 ), ( 450, 100, 49 ), ( 450, 150, 42 ), ( 450, 200, 35 ), ( 450, 250, 28 ), ( 450, 300, 21 ), ( 450, 350, 14 ), ( 450, 400, 7 ),
( 500, 0, 70 ), ( 500, 50, 63 ), ( 500, 100, 56 ), ( 500, 150, 49 ), ( 500, 200, 42 ), ( 500, 250, 35 ), ( 500, 300, 28 ), ( 500, 350, 21 ), ( 500, 400, 14 ), ( 500, 450, 7 ),
( 550, 0, 77 ), ( 550, 50, 70 ), ( 550, 100, 63 ), ( 550, 150, 56 ), ( 550, 200, 49 ), ( 550, 250, 42 ), ( 550, 300, 35 ), ( 550, 350, 28 ), ( 550, 400, 21 ), ( 550, 450, 14 ), ( 550, 500, 7 ),
( 600, 0, 84 ), ( 600, 50, 77 ), ( 600, 100, 70 ), ( 600, 150, 63 ), ( 600, 200, 56 ), ( 600, 250, 49 ), ( 600, 300, 42 ), ( 600, 350, 35 ), ( 600, 400, 28 ), ( 600, 450, 21 ), ( 600, 500, 14 ), ( 600, 550, 7 ),
( 650, 0, 91 ), ( 650, 50, 84 ), ( 650, 100, 77 ), ( 650, 150, 70 ), ( 650, 200, 63 ), ( 650, 250, 56 ), ( 650, 300, 49 ), ( 650, 350, 42 ), ( 650, 400, 35 ), ( 650, 450, 28 ), ( 650, 500, 21 ), ( 650, 550, 14 ), ( 650, 600, 7 ),
( 700, 0, 98 ), ( 700, 50, 91 ), ( 700, 100, 84 ), ( 700, 150, 77 ), ( 700, 200, 70 ), ( 700, 250, 63 ), ( 700, 300, 56 ), ( 700, 350, 49 ), ( 700, 400, 42 ), ( 700, 450, 35 ), ( 700, 500, 28 ), ( 700, 550, 21 ), ( 700, 600, 14 ), ( 700, 650, 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 "}"