The rational number 50/23 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/23 = (50-0)/23 = {

( 50, 0, 23 ),

( 100, 0, 46 ), ( 100, 50, 23 ),

( 150, 0, 69 ), ( 150, 50, 46 ), ( 150, 100, 23 ),

( 200, 0, 92 ), ( 200, 50, 69 ), ( 200, 100, 46 ), ( 200, 150, 23 ),

( 250, 0, 115 ), ( 250, 50, 92 ), ( 250, 100, 69 ), ( 250, 150, 46 ), ( 250, 200, 23 ),

( 300, 0, 138 ), ( 300, 50, 115 ), ( 300, 100, 92 ), ( 300, 150, 69 ), ( 300, 200, 46 ), ( 300, 250, 23 ),

( 350, 0, 161 ), ( 350, 50, 138 ), ( 350, 100, 115 ), ( 350, 150, 92 ), ( 350, 200, 69 ), ( 350, 250, 46 ), ( 350, 300, 23 ),

( 400, 0, 184 ), ( 400, 50, 161 ), ( 400, 100, 138 ), ( 400, 150, 115 ), ( 400, 200, 92 ), ( 400, 250, 69 ), ( 400, 300, 46 ), ( 400, 350, 23 ),

( 450, 0, 207 ), ( 450, 50, 184 ), ( 450, 100, 161 ), ( 450, 150, 138 ), ( 450, 200, 115 ), ( 450, 250, 92 ), ( 450, 300, 69 ), ( 450, 350, 46 ), ( 450, 400, 23 ),

( 500, 0, 230 ), ( 500, 50, 207 ), ( 500, 100, 184 ), ( 500, 150, 161 ), ( 500, 200, 138 ), ( 500, 250, 115 ), ( 500, 300, 92 ), ( 500, 350, 69 ), ( 500, 400, 46 ), ( 500, 450, 23 ),

( 550, 0, 253 ), ( 550, 50, 230 ), ( 550, 100, 207 ), ( 550, 150, 184 ), ( 550, 200, 161 ), ( 550, 250, 138 ), ( 550, 300, 115 ), ( 550, 350, 92 ), ( 550, 400, 69 ), ( 550, 450, 46 ), ( 550, 500, 23 ),

( 600, 0, 276 ), ( 600, 50, 253 ), ( 600, 100, 230 ), ( 600, 150, 207 ), ( 600, 200, 184 ), ( 600, 250, 161 ), ( 600, 300, 138 ), ( 600, 350, 115 ), ( 600, 400, 92 ), ( 600, 450, 69 ), ( 600, 500, 46 ), ( 600, 550, 23 ),

( 650, 0, 299 ), ( 650, 50, 276 ), ( 650, 100, 253 ), ( 650, 150, 230 ), ( 650, 200, 207 ), ( 650, 250, 184 ), ( 650, 300, 161 ), ( 650, 350, 138 ), ( 650, 400, 115 ), ( 650, 450, 92 ), ( 650, 500, 69 ), ( 650, 550, 46 ), ( 650, 600, 23 ),

( 700, 0, 322 ), ( 700, 50, 299 ), ( 700, 100, 276 ), ( 700, 150, 253 ), ( 700, 200, 230 ), ( 700, 250, 207 ), ( 700, 300, 184 ), ( 700, 350, 161 ), ( 700, 400, 138 ), ( 700, 450, 115 ), ( 700, 500, 92 ), ( 700, 550, 69 ), ( 700, 600, 46 ), ( 700, 650, 23 ),

...

}

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)