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

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

( 13, 0, 6 ),

( 26, 0, 12 ), ( 26, 13, 6 ),

( 39, 0, 18 ), ( 39, 13, 12 ), ( 39, 26, 6 ),

( 52, 0, 24 ), ( 52, 13, 18 ), ( 52, 26, 12 ), ( 52, 39, 6 ),

( 65, 0, 30 ), ( 65, 13, 24 ), ( 65, 26, 18 ), ( 65, 39, 12 ), ( 65, 52, 6 ),

( 78, 0, 36 ), ( 78, 13, 30 ), ( 78, 26, 24 ), ( 78, 39, 18 ), ( 78, 52, 12 ), ( 78, 65, 6 ),

( 91, 0, 42 ), ( 91, 13, 36 ), ( 91, 26, 30 ), ( 91, 39, 24 ), ( 91, 52, 18 ), ( 91, 65, 12 ), ( 91, 78, 6 ),

( 104, 0, 48 ), ( 104, 13, 42 ), ( 104, 26, 36 ), ( 104, 39, 30 ), ( 104, 52, 24 ), ( 104, 65, 18 ), ( 104, 78, 12 ), ( 104, 91, 6 ),

( 117, 0, 54 ), ( 117, 13, 48 ), ( 117, 26, 42 ), ( 117, 39, 36 ), ( 117, 52, 30 ), ( 117, 65, 24 ), ( 117, 78, 18 ), ( 117, 91, 12 ), ( 117, 104, 6 ),

( 130, 0, 60 ), ( 130, 13, 54 ), ( 130, 26, 48 ), ( 130, 39, 42 ), ( 130, 52, 36 ), ( 130, 65, 30 ), ( 130, 78, 24 ), ( 130, 91, 18 ), ( 130, 104, 12 ), ( 130, 117, 6 ),

( 143, 0, 66 ), ( 143, 13, 60 ), ( 143, 26, 54 ), ( 143, 39, 48 ), ( 143, 52, 42 ), ( 143, 65, 36 ), ( 143, 78, 30 ), ( 143, 91, 24 ), ( 143, 104, 18 ), ( 143, 117, 12 ), ( 143, 130, 6 ),

( 156, 0, 72 ), ( 156, 13, 66 ), ( 156, 26, 60 ), ( 156, 39, 54 ), ( 156, 52, 48 ), ( 156, 65, 42 ), ( 156, 78, 36 ), ( 156, 91, 30 ), ( 156, 104, 24 ), ( 156, 117, 18 ), ( 156, 130, 12 ), ( 156, 143, 6 ),

( 169, 0, 78 ), ( 169, 13, 72 ), ( 169, 26, 66 ), ( 169, 39, 60 ), ( 169, 52, 54 ), ( 169, 65, 48 ), ( 169, 78, 42 ), ( 169, 91, 36 ), ( 169, 104, 30 ), ( 169, 117, 24 ), ( 169, 130, 18 ), ( 169, 143, 12 ), ( 169, 156, 6 ),

( 182, 0, 84 ), ( 182, 13, 78 ), ( 182, 26, 72 ), ( 182, 39, 66 ), ( 182, 52, 60 ), ( 182, 65, 54 ), ( 182, 78, 48 ), ( 182, 91, 42 ), ( 182, 104, 36 ), ( 182, 117, 30 ), ( 182, 130, 24 ), ( 182, 143, 18 ), ( 182, 156, 12 ), ( 182, 169, 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)