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

( 16, 0, 1 ),

( 32, 0, 2 ), ( 32, 16, 1 ),

( 48, 0, 3 ), ( 48, 16, 2 ), ( 48, 32, 1 ),

( 64, 0, 4 ), ( 64, 16, 3 ), ( 64, 32, 2 ), ( 64, 48, 1 ),

( 80, 0, 5 ), ( 80, 16, 4 ), ( 80, 32, 3 ), ( 80, 48, 2 ), ( 80, 64, 1 ),

( 96, 0, 6 ), ( 96, 16, 5 ), ( 96, 32, 4 ), ( 96, 48, 3 ), ( 96, 64, 2 ), ( 96, 80, 1 ),

( 112, 0, 7 ), ( 112, 16, 6 ), ( 112, 32, 5 ), ( 112, 48, 4 ), ( 112, 64, 3 ), ( 112, 80, 2 ), ( 112, 96, 1 ),

( 128, 0, 8 ), ( 128, 16, 7 ), ( 128, 32, 6 ), ( 128, 48, 5 ), ( 128, 64, 4 ), ( 128, 80, 3 ), ( 128, 96, 2 ), ( 128, 112, 1 ),

( 144, 0, 9 ), ( 144, 16, 8 ), ( 144, 32, 7 ), ( 144, 48, 6 ), ( 144, 64, 5 ), ( 144, 80, 4 ), ( 144, 96, 3 ), ( 144, 112, 2 ), ( 144, 128, 1 ),

( 160, 0, 10 ), ( 160, 16, 9 ), ( 160, 32, 8 ), ( 160, 48, 7 ), ( 160, 64, 6 ), ( 160, 80, 5 ), ( 160, 96, 4 ), ( 160, 112, 3 ), ( 160, 128, 2 ), ( 160, 144, 1 ),

( 176, 0, 11 ), ( 176, 16, 10 ), ( 176, 32, 9 ), ( 176, 48, 8 ), ( 176, 64, 7 ), ( 176, 80, 6 ), ( 176, 96, 5 ), ( 176, 112, 4 ), ( 176, 128, 3 ), ( 176, 144, 2 ), ( 176, 160, 1 ),

( 192, 0, 12 ), ( 192, 16, 11 ), ( 192, 32, 10 ), ( 192, 48, 9 ), ( 192, 64, 8 ), ( 192, 80, 7 ), ( 192, 96, 6 ), ( 192, 112, 5 ), ( 192, 128, 4 ), ( 192, 144, 3 ), ( 192, 160, 2 ), ( 192, 176, 1 ),

( 208, 0, 13 ), ( 208, 16, 12 ), ( 208, 32, 11 ), ( 208, 48, 10 ), ( 208, 64, 9 ), ( 208, 80, 8 ), ( 208, 96, 7 ), ( 208, 112, 6 ), ( 208, 128, 5 ), ( 208, 144, 4 ), ( 208, 160, 3 ), ( 208, 176, 2 ), ( 208, 192, 1 ),

( 224, 0, 14 ), ( 224, 16, 13 ), ( 224, 32, 12 ), ( 224, 48, 11 ), ( 224, 64, 10 ), ( 224, 80, 9 ), ( 224, 96, 8 ), ( 224, 112, 7 ), ( 224, 128, 6 ), ( 224, 144, 5 ), ( 224, 160, 4 ), ( 224, 176, 3 ), ( 224, 192, 2 ), ( 224, 208, 1 ),

...

}

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)