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.
( 70, 0, 22 ), ( 70, 35, 11 ),
( 105, 0, 33 ), ( 105, 35, 22 ), ( 105, 70, 11 ),
( 140, 0, 44 ), ( 140, 35, 33 ), ( 140, 70, 22 ), ( 140, 105, 11 ),
( 175, 0, 55 ), ( 175, 35, 44 ), ( 175, 70, 33 ), ( 175, 105, 22 ), ( 175, 140, 11 ),
( 210, 0, 66 ), ( 210, 35, 55 ), ( 210, 70, 44 ), ( 210, 105, 33 ), ( 210, 140, 22 ), ( 210, 175, 11 ),
( 245, 0, 77 ), ( 245, 35, 66 ), ( 245, 70, 55 ), ( 245, 105, 44 ), ( 245, 140, 33 ), ( 245, 175, 22 ), ( 245, 210, 11 ),
( 280, 0, 88 ), ( 280, 35, 77 ), ( 280, 70, 66 ), ( 280, 105, 55 ), ( 280, 140, 44 ), ( 280, 175, 33 ), ( 280, 210, 22 ), ( 280, 245, 11 ),
( 315, 0, 99 ), ( 315, 35, 88 ), ( 315, 70, 77 ), ( 315, 105, 66 ), ( 315, 140, 55 ), ( 315, 175, 44 ), ( 315, 210, 33 ), ( 315, 245, 22 ), ( 315, 280, 11 ),
( 350, 0, 110 ), ( 350, 35, 99 ), ( 350, 70, 88 ), ( 350, 105, 77 ), ( 350, 140, 66 ), ( 350, 175, 55 ), ( 350, 210, 44 ), ( 350, 245, 33 ), ( 350, 280, 22 ), ( 350, 315, 11 ),
( 385, 0, 121 ), ( 385, 35, 110 ), ( 385, 70, 99 ), ( 385, 105, 88 ), ( 385, 140, 77 ), ( 385, 175, 66 ), ( 385, 210, 55 ), ( 385, 245, 44 ), ( 385, 280, 33 ), ( 385, 315, 22 ), ( 385, 350, 11 ),
( 420, 0, 132 ), ( 420, 35, 121 ), ( 420, 70, 110 ), ( 420, 105, 99 ), ( 420, 140, 88 ), ( 420, 175, 77 ), ( 420, 210, 66 ), ( 420, 245, 55 ), ( 420, 280, 44 ), ( 420, 315, 33 ), ( 420, 350, 22 ), ( 420, 385, 11 ),
( 455, 0, 143 ), ( 455, 35, 132 ), ( 455, 70, 121 ), ( 455, 105, 110 ), ( 455, 140, 99 ), ( 455, 175, 88 ), ( 455, 210, 77 ), ( 455, 245, 66 ), ( 455, 280, 55 ), ( 455, 315, 44 ), ( 455, 350, 33 ), ( 455, 385, 22 ), ( 455, 420, 11 ),
( 490, 0, 154 ), ( 490, 35, 143 ), ( 490, 70, 132 ), ( 490, 105, 121 ), ( 490, 140, 110 ), ( 490, 175, 99 ), ( 490, 210, 88 ), ( 490, 245, 77 ), ( 490, 280, 66 ), ( 490, 315, 55 ), ( 490, 350, 44 ), ( 490, 385, 33 ), ( 490, 420, 22 ), ( 490, 455, 11 ),
...
}
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 "}"