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

8/1 = (8-0)/1 = {

( 8, 0, 1 ),

( 16, 0, 2 ), ( 16, 8, 1 ),

( 24, 0, 3 ), ( 24, 8, 2 ), ( 24, 16, 1 ),

( 32, 0, 4 ), ( 32, 8, 3 ), ( 32, 16, 2 ), ( 32, 24, 1 ),

( 40, 0, 5 ), ( 40, 8, 4 ), ( 40, 16, 3 ), ( 40, 24, 2 ), ( 40, 32, 1 ),

( 48, 0, 6 ), ( 48, 8, 5 ), ( 48, 16, 4 ), ( 48, 24, 3 ), ( 48, 32, 2 ), ( 48, 40, 1 ),

( 56, 0, 7 ), ( 56, 8, 6 ), ( 56, 16, 5 ), ( 56, 24, 4 ), ( 56, 32, 3 ), ( 56, 40, 2 ), ( 56, 48, 1 ),

( 64, 0, 8 ), ( 64, 8, 7 ), ( 64, 16, 6 ), ( 64, 24, 5 ), ( 64, 32, 4 ), ( 64, 40, 3 ), ( 64, 48, 2 ), ( 64, 56, 1 ),

( 72, 0, 9 ), ( 72, 8, 8 ), ( 72, 16, 7 ), ( 72, 24, 6 ), ( 72, 32, 5 ), ( 72, 40, 4 ), ( 72, 48, 3 ), ( 72, 56, 2 ), ( 72, 64, 1 ),

( 80, 0, 10 ), ( 80, 8, 9 ), ( 80, 16, 8 ), ( 80, 24, 7 ), ( 80, 32, 6 ), ( 80, 40, 5 ), ( 80, 48, 4 ), ( 80, 56, 3 ), ( 80, 64, 2 ), ( 80, 72, 1 ),

( 88, 0, 11 ), ( 88, 8, 10 ), ( 88, 16, 9 ), ( 88, 24, 8 ), ( 88, 32, 7 ), ( 88, 40, 6 ), ( 88, 48, 5 ), ( 88, 56, 4 ), ( 88, 64, 3 ), ( 88, 72, 2 ), ( 88, 80, 1 ),

( 96, 0, 12 ), ( 96, 8, 11 ), ( 96, 16, 10 ), ( 96, 24, 9 ), ( 96, 32, 8 ), ( 96, 40, 7 ), ( 96, 48, 6 ), ( 96, 56, 5 ), ( 96, 64, 4 ), ( 96, 72, 3 ), ( 96, 80, 2 ), ( 96, 88, 1 ),

( 104, 0, 13 ), ( 104, 8, 12 ), ( 104, 16, 11 ), ( 104, 24, 10 ), ( 104, 32, 9 ), ( 104, 40, 8 ), ( 104, 48, 7 ), ( 104, 56, 6 ), ( 104, 64, 5 ), ( 104, 72, 4 ), ( 104, 80, 3 ), ( 104, 88, 2 ), ( 104, 96, 1 ),

( 112, 0, 14 ), ( 112, 8, 13 ), ( 112, 16, 12 ), ( 112, 24, 11 ), ( 112, 32, 10 ), ( 112, 40, 9 ), ( 112, 48, 8 ), ( 112, 56, 7 ), ( 112, 64, 6 ), ( 112, 72, 5 ), ( 112, 80, 4 ), ( 112, 88, 3 ), ( 112, 96, 2 ), ( 112, 104, 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)