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

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

( 9, 0, 1 ),

( 18, 0, 2 ), ( 18, 9, 1 ),

( 27, 0, 3 ), ( 27, 9, 2 ), ( 27, 18, 1 ),

( 36, 0, 4 ), ( 36, 9, 3 ), ( 36, 18, 2 ), ( 36, 27, 1 ),

( 45, 0, 5 ), ( 45, 9, 4 ), ( 45, 18, 3 ), ( 45, 27, 2 ), ( 45, 36, 1 ),

( 54, 0, 6 ), ( 54, 9, 5 ), ( 54, 18, 4 ), ( 54, 27, 3 ), ( 54, 36, 2 ), ( 54, 45, 1 ),

( 63, 0, 7 ), ( 63, 9, 6 ), ( 63, 18, 5 ), ( 63, 27, 4 ), ( 63, 36, 3 ), ( 63, 45, 2 ), ( 63, 54, 1 ),

( 72, 0, 8 ), ( 72, 9, 7 ), ( 72, 18, 6 ), ( 72, 27, 5 ), ( 72, 36, 4 ), ( 72, 45, 3 ), ( 72, 54, 2 ), ( 72, 63, 1 ),

( 81, 0, 9 ), ( 81, 9, 8 ), ( 81, 18, 7 ), ( 81, 27, 6 ), ( 81, 36, 5 ), ( 81, 45, 4 ), ( 81, 54, 3 ), ( 81, 63, 2 ), ( 81, 72, 1 ),

( 90, 0, 10 ), ( 90, 9, 9 ), ( 90, 18, 8 ), ( 90, 27, 7 ), ( 90, 36, 6 ), ( 90, 45, 5 ), ( 90, 54, 4 ), ( 90, 63, 3 ), ( 90, 72, 2 ), ( 90, 81, 1 ),

( 99, 0, 11 ), ( 99, 9, 10 ), ( 99, 18, 9 ), ( 99, 27, 8 ), ( 99, 36, 7 ), ( 99, 45, 6 ), ( 99, 54, 5 ), ( 99, 63, 4 ), ( 99, 72, 3 ), ( 99, 81, 2 ), ( 99, 90, 1 ),

( 108, 0, 12 ), ( 108, 9, 11 ), ( 108, 18, 10 ), ( 108, 27, 9 ), ( 108, 36, 8 ), ( 108, 45, 7 ), ( 108, 54, 6 ), ( 108, 63, 5 ), ( 108, 72, 4 ), ( 108, 81, 3 ), ( 108, 90, 2 ), ( 108, 99, 1 ),

( 117, 0, 13 ), ( 117, 9, 12 ), ( 117, 18, 11 ), ( 117, 27, 10 ), ( 117, 36, 9 ), ( 117, 45, 8 ), ( 117, 54, 7 ), ( 117, 63, 6 ), ( 117, 72, 5 ), ( 117, 81, 4 ), ( 117, 90, 3 ), ( 117, 99, 2 ), ( 117, 108, 1 ),

( 126, 0, 14 ), ( 126, 9, 13 ), ( 126, 18, 12 ), ( 126, 27, 11 ), ( 126, 36, 10 ), ( 126, 45, 9 ), ( 126, 54, 8 ), ( 126, 63, 7 ), ( 126, 72, 6 ), ( 126, 81, 5 ), ( 126, 90, 4 ), ( 126, 99, 3 ), ( 126, 108, 2 ), ( 126, 117, 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)