The rational number 16/11 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.

16/11 = (16-0)/11 = {

( 16, 0, 11 ),

( 32, 0, 22 ), ( 32, 16, 11 ),

( 48, 0, 33 ), ( 48, 16, 22 ), ( 48, 32, 11 ),

( 64, 0, 44 ), ( 64, 16, 33 ), ( 64, 32, 22 ), ( 64, 48, 11 ),

( 80, 0, 55 ), ( 80, 16, 44 ), ( 80, 32, 33 ), ( 80, 48, 22 ), ( 80, 64, 11 ),

( 96, 0, 66 ), ( 96, 16, 55 ), ( 96, 32, 44 ), ( 96, 48, 33 ), ( 96, 64, 22 ), ( 96, 80, 11 ),

( 112, 0, 77 ), ( 112, 16, 66 ), ( 112, 32, 55 ), ( 112, 48, 44 ), ( 112, 64, 33 ), ( 112, 80, 22 ), ( 112, 96, 11 ),

( 128, 0, 88 ), ( 128, 16, 77 ), ( 128, 32, 66 ), ( 128, 48, 55 ), ( 128, 64, 44 ), ( 128, 80, 33 ), ( 128, 96, 22 ), ( 128, 112, 11 ),

( 144, 0, 99 ), ( 144, 16, 88 ), ( 144, 32, 77 ), ( 144, 48, 66 ), ( 144, 64, 55 ), ( 144, 80, 44 ), ( 144, 96, 33 ), ( 144, 112, 22 ), ( 144, 128, 11 ),

( 160, 0, 110 ), ( 160, 16, 99 ), ( 160, 32, 88 ), ( 160, 48, 77 ), ( 160, 64, 66 ), ( 160, 80, 55 ), ( 160, 96, 44 ), ( 160, 112, 33 ), ( 160, 128, 22 ), ( 160, 144, 11 ),

( 176, 0, 121 ), ( 176, 16, 110 ), ( 176, 32, 99 ), ( 176, 48, 88 ), ( 176, 64, 77 ), ( 176, 80, 66 ), ( 176, 96, 55 ), ( 176, 112, 44 ), ( 176, 128, 33 ), ( 176, 144, 22 ), ( 176, 160, 11 ),

( 192, 0, 132 ), ( 192, 16, 121 ), ( 192, 32, 110 ), ( 192, 48, 99 ), ( 192, 64, 88 ), ( 192, 80, 77 ), ( 192, 96, 66 ), ( 192, 112, 55 ), ( 192, 128, 44 ), ( 192, 144, 33 ), ( 192, 160, 22 ), ( 192, 176, 11 ),

( 208, 0, 143 ), ( 208, 16, 132 ), ( 208, 32, 121 ), ( 208, 48, 110 ), ( 208, 64, 99 ), ( 208, 80, 88 ), ( 208, 96, 77 ), ( 208, 112, 66 ), ( 208, 128, 55 ), ( 208, 144, 44 ), ( 208, 160, 33 ), ( 208, 176, 22 ), ( 208, 192, 11 ),

( 224, 0, 154 ), ( 224, 16, 143 ), ( 224, 32, 132 ), ( 224, 48, 121 ), ( 224, 64, 110 ), ( 224, 80, 99 ), ( 224, 96, 88 ), ( 224, 112, 77 ), ( 224, 128, 66 ), ( 224, 144, 55 ), ( 224, 160, 44 ), ( 224, 176, 33 ), ( 224, 192, 22 ), ( 224, 208, 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 "}"

(back to √2)