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

( 50, 0, 17 ),

( 100, 0, 34 ), ( 100, 50, 17 ),

( 150, 0, 51 ), ( 150, 50, 34 ), ( 150, 100, 17 ),

( 200, 0, 68 ), ( 200, 50, 51 ), ( 200, 100, 34 ), ( 200, 150, 17 ),

( 250, 0, 85 ), ( 250, 50, 68 ), ( 250, 100, 51 ), ( 250, 150, 34 ), ( 250, 200, 17 ),

( 300, 0, 102 ), ( 300, 50, 85 ), ( 300, 100, 68 ), ( 300, 150, 51 ), ( 300, 200, 34 ), ( 300, 250, 17 ),

( 350, 0, 119 ), ( 350, 50, 102 ), ( 350, 100, 85 ), ( 350, 150, 68 ), ( 350, 200, 51 ), ( 350, 250, 34 ), ( 350, 300, 17 ),

( 400, 0, 136 ), ( 400, 50, 119 ), ( 400, 100, 102 ), ( 400, 150, 85 ), ( 400, 200, 68 ), ( 400, 250, 51 ), ( 400, 300, 34 ), ( 400, 350, 17 ),

( 450, 0, 153 ), ( 450, 50, 136 ), ( 450, 100, 119 ), ( 450, 150, 102 ), ( 450, 200, 85 ), ( 450, 250, 68 ), ( 450, 300, 51 ), ( 450, 350, 34 ), ( 450, 400, 17 ),

( 500, 0, 170 ), ( 500, 50, 153 ), ( 500, 100, 136 ), ( 500, 150, 119 ), ( 500, 200, 102 ), ( 500, 250, 85 ), ( 500, 300, 68 ), ( 500, 350, 51 ), ( 500, 400, 34 ), ( 500, 450, 17 ),

( 550, 0, 187 ), ( 550, 50, 170 ), ( 550, 100, 153 ), ( 550, 150, 136 ), ( 550, 200, 119 ), ( 550, 250, 102 ), ( 550, 300, 85 ), ( 550, 350, 68 ), ( 550, 400, 51 ), ( 550, 450, 34 ), ( 550, 500, 17 ),

( 600, 0, 204 ), ( 600, 50, 187 ), ( 600, 100, 170 ), ( 600, 150, 153 ), ( 600, 200, 136 ), ( 600, 250, 119 ), ( 600, 300, 102 ), ( 600, 350, 85 ), ( 600, 400, 68 ), ( 600, 450, 51 ), ( 600, 500, 34 ), ( 600, 550, 17 ),

( 650, 0, 221 ), ( 650, 50, 204 ), ( 650, 100, 187 ), ( 650, 150, 170 ), ( 650, 200, 153 ), ( 650, 250, 136 ), ( 650, 300, 119 ), ( 650, 350, 102 ), ( 650, 400, 85 ), ( 650, 450, 68 ), ( 650, 500, 51 ), ( 650, 550, 34 ), ( 650, 600, 17 ),

( 700, 0, 238 ), ( 700, 50, 221 ), ( 700, 100, 204 ), ( 700, 150, 187 ), ( 700, 200, 170 ), ( 700, 250, 153 ), ( 700, 300, 136 ), ( 700, 350, 119 ), ( 700, 400, 102 ), ( 700, 450, 85 ), ( 700, 500, 68 ), ( 700, 550, 51 ), ( 700, 600, 34 ), ( 700, 650, 17 ),

...

}

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)