The rational number 50/21 as a set

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/21 = (50-0)/21 = {

( 50, 0, 21 ),

( 100, 0, 42 ), ( 100, 50, 21 ),

( 150, 0, 63 ), ( 150, 50, 42 ), ( 150, 100, 21 ),

( 200, 0, 84 ), ( 200, 50, 63 ), ( 200, 100, 42 ), ( 200, 150, 21 ),

( 250, 0, 105 ), ( 250, 50, 84 ), ( 250, 100, 63 ), ( 250, 150, 42 ), ( 250, 200, 21 ),

( 300, 0, 126 ), ( 300, 50, 105 ), ( 300, 100, 84 ), ( 300, 150, 63 ), ( 300, 200, 42 ), ( 300, 250, 21 ),

( 350, 0, 147 ), ( 350, 50, 126 ), ( 350, 100, 105 ), ( 350, 150, 84 ), ( 350, 200, 63 ), ( 350, 250, 42 ), ( 350, 300, 21 ),

( 400, 0, 168 ), ( 400, 50, 147 ), ( 400, 100, 126 ), ( 400, 150, 105 ), ( 400, 200, 84 ), ( 400, 250, 63 ), ( 400, 300, 42 ), ( 400, 350, 21 ),

( 450, 0, 189 ), ( 450, 50, 168 ), ( 450, 100, 147 ), ( 450, 150, 126 ), ( 450, 200, 105 ), ( 450, 250, 84 ), ( 450, 300, 63 ), ( 450, 350, 42 ), ( 450, 400, 21 ),

( 500, 0, 210 ), ( 500, 50, 189 ), ( 500, 100, 168 ), ( 500, 150, 147 ), ( 500, 200, 126 ), ( 500, 250, 105 ), ( 500, 300, 84 ), ( 500, 350, 63 ), ( 500, 400, 42 ), ( 500, 450, 21 ),

( 550, 0, 231 ), ( 550, 50, 210 ), ( 550, 100, 189 ), ( 550, 150, 168 ), ( 550, 200, 147 ), ( 550, 250, 126 ), ( 550, 300, 105 ), ( 550, 350, 84 ), ( 550, 400, 63 ), ( 550, 450, 42 ), ( 550, 500, 21 ),

( 600, 0, 252 ), ( 600, 50, 231 ), ( 600, 100, 210 ), ( 600, 150, 189 ), ( 600, 200, 168 ), ( 600, 250, 147 ), ( 600, 300, 126 ), ( 600, 350, 105 ), ( 600, 400, 84 ), ( 600, 450, 63 ), ( 600, 500, 42 ), ( 600, 550, 21 ),

( 650, 0, 273 ), ( 650, 50, 252 ), ( 650, 100, 231 ), ( 650, 150, 210 ), ( 650, 200, 189 ), ( 650, 250, 168 ), ( 650, 300, 147 ), ( 650, 350, 126 ), ( 650, 400, 105 ), ( 650, 450, 84 ), ( 650, 500, 63 ), ( 650, 550, 42 ), ( 650, 600, 21 ),

( 700, 0, 294 ), ( 700, 50, 273 ), ( 700, 100, 252 ), ( 700, 150, 231 ), ( 700, 200, 210 ), ( 700, 250, 189 ), ( 700, 300, 168 ), ( 700, 350, 147 ), ( 700, 400, 126 ), ( 700, 450, 105 ), ( 700, 500, 84 ), ( 700, 550, 63 ), ( 700, 600, 42 ), ( 700, 650, 21 ),

...

}

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 "}"

(back to √2)