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

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

( 18, 0, 11 ),

( 36, 0, 22 ), ( 36, 18, 11 ),

( 54, 0, 33 ), ( 54, 18, 22 ), ( 54, 36, 11 ),

( 72, 0, 44 ), ( 72, 18, 33 ), ( 72, 36, 22 ), ( 72, 54, 11 ),

( 90, 0, 55 ), ( 90, 18, 44 ), ( 90, 36, 33 ), ( 90, 54, 22 ), ( 90, 72, 11 ),

( 108, 0, 66 ), ( 108, 18, 55 ), ( 108, 36, 44 ), ( 108, 54, 33 ), ( 108, 72, 22 ), ( 108, 90, 11 ),

( 126, 0, 77 ), ( 126, 18, 66 ), ( 126, 36, 55 ), ( 126, 54, 44 ), ( 126, 72, 33 ), ( 126, 90, 22 ), ( 126, 108, 11 ),

( 144, 0, 88 ), ( 144, 18, 77 ), ( 144, 36, 66 ), ( 144, 54, 55 ), ( 144, 72, 44 ), ( 144, 90, 33 ), ( 144, 108, 22 ), ( 144, 126, 11 ),

( 162, 0, 99 ), ( 162, 18, 88 ), ( 162, 36, 77 ), ( 162, 54, 66 ), ( 162, 72, 55 ), ( 162, 90, 44 ), ( 162, 108, 33 ), ( 162, 126, 22 ), ( 162, 144, 11 ),

( 180, 0, 110 ), ( 180, 18, 99 ), ( 180, 36, 88 ), ( 180, 54, 77 ), ( 180, 72, 66 ), ( 180, 90, 55 ), ( 180, 108, 44 ), ( 180, 126, 33 ), ( 180, 144, 22 ), ( 180, 162, 11 ),

( 198, 0, 121 ), ( 198, 18, 110 ), ( 198, 36, 99 ), ( 198, 54, 88 ), ( 198, 72, 77 ), ( 198, 90, 66 ), ( 198, 108, 55 ), ( 198, 126, 44 ), ( 198, 144, 33 ), ( 198, 162, 22 ), ( 198, 180, 11 ),

( 216, 0, 132 ), ( 216, 18, 121 ), ( 216, 36, 110 ), ( 216, 54, 99 ), ( 216, 72, 88 ), ( 216, 90, 77 ), ( 216, 108, 66 ), ( 216, 126, 55 ), ( 216, 144, 44 ), ( 216, 162, 33 ), ( 216, 180, 22 ), ( 216, 198, 11 ),

( 234, 0, 143 ), ( 234, 18, 132 ), ( 234, 36, 121 ), ( 234, 54, 110 ), ( 234, 72, 99 ), ( 234, 90, 88 ), ( 234, 108, 77 ), ( 234, 126, 66 ), ( 234, 144, 55 ), ( 234, 162, 44 ), ( 234, 180, 33 ), ( 234, 198, 22 ), ( 234, 216, 11 ),

( 252, 0, 154 ), ( 252, 18, 143 ), ( 252, 36, 132 ), ( 252, 54, 121 ), ( 252, 72, 110 ), ( 252, 90, 99 ), ( 252, 108, 88 ), ( 252, 126, 77 ), ( 252, 144, 66 ), ( 252, 162, 55 ), ( 252, 180, 44 ), ( 252, 198, 33 ), ( 252, 216, 22 ), ( 252, 234, 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)