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

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

( 10, 0, 1 ),

( 20, 0, 2 ), ( 20, 10, 1 ),

( 30, 0, 3 ), ( 30, 10, 2 ), ( 30, 20, 1 ),

( 40, 0, 4 ), ( 40, 10, 3 ), ( 40, 20, 2 ), ( 40, 30, 1 ),

( 50, 0, 5 ), ( 50, 10, 4 ), ( 50, 20, 3 ), ( 50, 30, 2 ), ( 50, 40, 1 ),

( 60, 0, 6 ), ( 60, 10, 5 ), ( 60, 20, 4 ), ( 60, 30, 3 ), ( 60, 40, 2 ), ( 60, 50, 1 ),

( 70, 0, 7 ), ( 70, 10, 6 ), ( 70, 20, 5 ), ( 70, 30, 4 ), ( 70, 40, 3 ), ( 70, 50, 2 ), ( 70, 60, 1 ),

( 80, 0, 8 ), ( 80, 10, 7 ), ( 80, 20, 6 ), ( 80, 30, 5 ), ( 80, 40, 4 ), ( 80, 50, 3 ), ( 80, 60, 2 ), ( 80, 70, 1 ),

( 90, 0, 9 ), ( 90, 10, 8 ), ( 90, 20, 7 ), ( 90, 30, 6 ), ( 90, 40, 5 ), ( 90, 50, 4 ), ( 90, 60, 3 ), ( 90, 70, 2 ), ( 90, 80, 1 ),

( 100, 0, 10 ), ( 100, 10, 9 ), ( 100, 20, 8 ), ( 100, 30, 7 ), ( 100, 40, 6 ), ( 100, 50, 5 ), ( 100, 60, 4 ), ( 100, 70, 3 ), ( 100, 80, 2 ), ( 100, 90, 1 ),

( 110, 0, 11 ), ( 110, 10, 10 ), ( 110, 20, 9 ), ( 110, 30, 8 ), ( 110, 40, 7 ), ( 110, 50, 6 ), ( 110, 60, 5 ), ( 110, 70, 4 ), ( 110, 80, 3 ), ( 110, 90, 2 ), ( 110, 100, 1 ),

( 120, 0, 12 ), ( 120, 10, 11 ), ( 120, 20, 10 ), ( 120, 30, 9 ), ( 120, 40, 8 ), ( 120, 50, 7 ), ( 120, 60, 6 ), ( 120, 70, 5 ), ( 120, 80, 4 ), ( 120, 90, 3 ), ( 120, 100, 2 ), ( 120, 110, 1 ),

( 130, 0, 13 ), ( 130, 10, 12 ), ( 130, 20, 11 ), ( 130, 30, 10 ), ( 130, 40, 9 ), ( 130, 50, 8 ), ( 130, 60, 7 ), ( 130, 70, 6 ), ( 130, 80, 5 ), ( 130, 90, 4 ), ( 130, 100, 3 ), ( 130, 110, 2 ), ( 130, 120, 1 ),

( 140, 0, 14 ), ( 140, 10, 13 ), ( 140, 20, 12 ), ( 140, 30, 11 ), ( 140, 40, 10 ), ( 140, 50, 9 ), ( 140, 60, 8 ), ( 140, 70, 7 ), ( 140, 80, 6 ), ( 140, 90, 5 ), ( 140, 100, 4 ), ( 140, 110, 3 ), ( 140, 120, 2 ), ( 140, 130, 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)