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

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

( 11, 0, 6 ),

( 22, 0, 12 ), ( 22, 11, 6 ),

( 33, 0, 18 ), ( 33, 11, 12 ), ( 33, 22, 6 ),

( 44, 0, 24 ), ( 44, 11, 18 ), ( 44, 22, 12 ), ( 44, 33, 6 ),

( 55, 0, 30 ), ( 55, 11, 24 ), ( 55, 22, 18 ), ( 55, 33, 12 ), ( 55, 44, 6 ),

( 66, 0, 36 ), ( 66, 11, 30 ), ( 66, 22, 24 ), ( 66, 33, 18 ), ( 66, 44, 12 ), ( 66, 55, 6 ),

( 77, 0, 42 ), ( 77, 11, 36 ), ( 77, 22, 30 ), ( 77, 33, 24 ), ( 77, 44, 18 ), ( 77, 55, 12 ), ( 77, 66, 6 ),

( 88, 0, 48 ), ( 88, 11, 42 ), ( 88, 22, 36 ), ( 88, 33, 30 ), ( 88, 44, 24 ), ( 88, 55, 18 ), ( 88, 66, 12 ), ( 88, 77, 6 ),

( 99, 0, 54 ), ( 99, 11, 48 ), ( 99, 22, 42 ), ( 99, 33, 36 ), ( 99, 44, 30 ), ( 99, 55, 24 ), ( 99, 66, 18 ), ( 99, 77, 12 ), ( 99, 88, 6 ),

( 110, 0, 60 ), ( 110, 11, 54 ), ( 110, 22, 48 ), ( 110, 33, 42 ), ( 110, 44, 36 ), ( 110, 55, 30 ), ( 110, 66, 24 ), ( 110, 77, 18 ), ( 110, 88, 12 ), ( 110, 99, 6 ),

( 121, 0, 66 ), ( 121, 11, 60 ), ( 121, 22, 54 ), ( 121, 33, 48 ), ( 121, 44, 42 ), ( 121, 55, 36 ), ( 121, 66, 30 ), ( 121, 77, 24 ), ( 121, 88, 18 ), ( 121, 99, 12 ), ( 121, 110, 6 ),

( 132, 0, 72 ), ( 132, 11, 66 ), ( 132, 22, 60 ), ( 132, 33, 54 ), ( 132, 44, 48 ), ( 132, 55, 42 ), ( 132, 66, 36 ), ( 132, 77, 30 ), ( 132, 88, 24 ), ( 132, 99, 18 ), ( 132, 110, 12 ), ( 132, 121, 6 ),

( 143, 0, 78 ), ( 143, 11, 72 ), ( 143, 22, 66 ), ( 143, 33, 60 ), ( 143, 44, 54 ), ( 143, 55, 48 ), ( 143, 66, 42 ), ( 143, 77, 36 ), ( 143, 88, 30 ), ( 143, 99, 24 ), ( 143, 110, 18 ), ( 143, 121, 12 ), ( 143, 132, 6 ),

( 154, 0, 84 ), ( 154, 11, 78 ), ( 154, 22, 72 ), ( 154, 33, 66 ), ( 154, 44, 60 ), ( 154, 55, 54 ), ( 154, 66, 48 ), ( 154, 77, 42 ), ( 154, 88, 36 ), ( 154, 99, 30 ), ( 154, 110, 24 ), ( 154, 121, 18 ), ( 154, 132, 12 ), ( 154, 143, 6 ),

...

}

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)