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

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

( 5, 0, 1 ),

( 10, 0, 2 ), ( 10, 5, 1 ),

( 15, 0, 3 ), ( 15, 5, 2 ), ( 15, 10, 1 ),

( 20, 0, 4 ), ( 20, 5, 3 ), ( 20, 10, 2 ), ( 20, 15, 1 ),

( 25, 0, 5 ), ( 25, 5, 4 ), ( 25, 10, 3 ), ( 25, 15, 2 ), ( 25, 20, 1 ),

( 30, 0, 6 ), ( 30, 5, 5 ), ( 30, 10, 4 ), ( 30, 15, 3 ), ( 30, 20, 2 ), ( 30, 25, 1 ),

( 35, 0, 7 ), ( 35, 5, 6 ), ( 35, 10, 5 ), ( 35, 15, 4 ), ( 35, 20, 3 ), ( 35, 25, 2 ), ( 35, 30, 1 ),

( 40, 0, 8 ), ( 40, 5, 7 ), ( 40, 10, 6 ), ( 40, 15, 5 ), ( 40, 20, 4 ), ( 40, 25, 3 ), ( 40, 30, 2 ), ( 40, 35, 1 ),

( 45, 0, 9 ), ( 45, 5, 8 ), ( 45, 10, 7 ), ( 45, 15, 6 ), ( 45, 20, 5 ), ( 45, 25, 4 ), ( 45, 30, 3 ), ( 45, 35, 2 ), ( 45, 40, 1 ),

( 50, 0, 10 ), ( 50, 5, 9 ), ( 50, 10, 8 ), ( 50, 15, 7 ), ( 50, 20, 6 ), ( 50, 25, 5 ), ( 50, 30, 4 ), ( 50, 35, 3 ), ( 50, 40, 2 ), ( 50, 45, 1 ),

( 55, 0, 11 ), ( 55, 5, 10 ), ( 55, 10, 9 ), ( 55, 15, 8 ), ( 55, 20, 7 ), ( 55, 25, 6 ), ( 55, 30, 5 ), ( 55, 35, 4 ), ( 55, 40, 3 ), ( 55, 45, 2 ), ( 55, 50, 1 ),

( 60, 0, 12 ), ( 60, 5, 11 ), ( 60, 10, 10 ), ( 60, 15, 9 ), ( 60, 20, 8 ), ( 60, 25, 7 ), ( 60, 30, 6 ), ( 60, 35, 5 ), ( 60, 40, 4 ), ( 60, 45, 3 ), ( 60, 50, 2 ), ( 60, 55, 1 ),

( 65, 0, 13 ), ( 65, 5, 12 ), ( 65, 10, 11 ), ( 65, 15, 10 ), ( 65, 20, 9 ), ( 65, 25, 8 ), ( 65, 30, 7 ), ( 65, 35, 6 ), ( 65, 40, 5 ), ( 65, 45, 4 ), ( 65, 50, 3 ), ( 65, 55, 2 ), ( 65, 60, 1 ),

( 70, 0, 14 ), ( 70, 5, 13 ), ( 70, 10, 12 ), ( 70, 15, 11 ), ( 70, 20, 10 ), ( 70, 25, 9 ), ( 70, 30, 8 ), ( 70, 35, 7 ), ( 70, 40, 6 ), ( 70, 45, 5 ), ( 70, 50, 4 ), ( 70, 55, 3 ), ( 70, 60, 2 ), ( 70, 65, 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)