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

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

( 34, 0, 11 ),

( 68, 0, 22 ), ( 68, 34, 11 ),

( 102, 0, 33 ), ( 102, 34, 22 ), ( 102, 68, 11 ),

( 136, 0, 44 ), ( 136, 34, 33 ), ( 136, 68, 22 ), ( 136, 102, 11 ),

( 170, 0, 55 ), ( 170, 34, 44 ), ( 170, 68, 33 ), ( 170, 102, 22 ), ( 170, 136, 11 ),

( 204, 0, 66 ), ( 204, 34, 55 ), ( 204, 68, 44 ), ( 204, 102, 33 ), ( 204, 136, 22 ), ( 204, 170, 11 ),

( 238, 0, 77 ), ( 238, 34, 66 ), ( 238, 68, 55 ), ( 238, 102, 44 ), ( 238, 136, 33 ), ( 238, 170, 22 ), ( 238, 204, 11 ),

( 272, 0, 88 ), ( 272, 34, 77 ), ( 272, 68, 66 ), ( 272, 102, 55 ), ( 272, 136, 44 ), ( 272, 170, 33 ), ( 272, 204, 22 ), ( 272, 238, 11 ),

( 306, 0, 99 ), ( 306, 34, 88 ), ( 306, 68, 77 ), ( 306, 102, 66 ), ( 306, 136, 55 ), ( 306, 170, 44 ), ( 306, 204, 33 ), ( 306, 238, 22 ), ( 306, 272, 11 ),

( 340, 0, 110 ), ( 340, 34, 99 ), ( 340, 68, 88 ), ( 340, 102, 77 ), ( 340, 136, 66 ), ( 340, 170, 55 ), ( 340, 204, 44 ), ( 340, 238, 33 ), ( 340, 272, 22 ), ( 340, 306, 11 ),

( 374, 0, 121 ), ( 374, 34, 110 ), ( 374, 68, 99 ), ( 374, 102, 88 ), ( 374, 136, 77 ), ( 374, 170, 66 ), ( 374, 204, 55 ), ( 374, 238, 44 ), ( 374, 272, 33 ), ( 374, 306, 22 ), ( 374, 340, 11 ),

( 408, 0, 132 ), ( 408, 34, 121 ), ( 408, 68, 110 ), ( 408, 102, 99 ), ( 408, 136, 88 ), ( 408, 170, 77 ), ( 408, 204, 66 ), ( 408, 238, 55 ), ( 408, 272, 44 ), ( 408, 306, 33 ), ( 408, 340, 22 ), ( 408, 374, 11 ),

( 442, 0, 143 ), ( 442, 34, 132 ), ( 442, 68, 121 ), ( 442, 102, 110 ), ( 442, 136, 99 ), ( 442, 170, 88 ), ( 442, 204, 77 ), ( 442, 238, 66 ), ( 442, 272, 55 ), ( 442, 306, 44 ), ( 442, 340, 33 ), ( 442, 374, 22 ), ( 442, 408, 11 ),

( 476, 0, 154 ), ( 476, 34, 143 ), ( 476, 68, 132 ), ( 476, 102, 121 ), ( 476, 136, 110 ), ( 476, 170, 99 ), ( 476, 204, 88 ), ( 476, 238, 77 ), ( 476, 272, 66 ), ( 476, 306, 55 ), ( 476, 340, 44 ), ( 476, 374, 33 ), ( 476, 408, 22 ), ( 476, 442, 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)