The rational number 5/3 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/3 = (5-0)/3 = {

( 5, 0, 3 ),

( 10, 0, 6 ), ( 10, 5, 3 ),

( 15, 0, 9 ), ( 15, 5, 6 ), ( 15, 10, 3 ),

( 20, 0, 12 ), ( 20, 5, 9 ), ( 20, 10, 6 ), ( 20, 15, 3 ),

( 25, 0, 15 ), ( 25, 5, 12 ), ( 25, 10, 9 ), ( 25, 15, 6 ), ( 25, 20, 3 ),

( 30, 0, 18 ), ( 30, 5, 15 ), ( 30, 10, 12 ), ( 30, 15, 9 ), ( 30, 20, 6 ), ( 30, 25, 3 ),

( 35, 0, 21 ), ( 35, 5, 18 ), ( 35, 10, 15 ), ( 35, 15, 12 ), ( 35, 20, 9 ), ( 35, 25, 6 ), ( 35, 30, 3 ),

( 40, 0, 24 ), ( 40, 5, 21 ), ( 40, 10, 18 ), ( 40, 15, 15 ), ( 40, 20, 12 ), ( 40, 25, 9 ), ( 40, 30, 6 ), ( 40, 35, 3 ),

( 45, 0, 27 ), ( 45, 5, 24 ), ( 45, 10, 21 ), ( 45, 15, 18 ), ( 45, 20, 15 ), ( 45, 25, 12 ), ( 45, 30, 9 ), ( 45, 35, 6 ), ( 45, 40, 3 ),

( 50, 0, 30 ), ( 50, 5, 27 ), ( 50, 10, 24 ), ( 50, 15, 21 ), ( 50, 20, 18 ), ( 50, 25, 15 ), ( 50, 30, 12 ), ( 50, 35, 9 ), ( 50, 40, 6 ), ( 50, 45, 3 ),

( 55, 0, 33 ), ( 55, 5, 30 ), ( 55, 10, 27 ), ( 55, 15, 24 ), ( 55, 20, 21 ), ( 55, 25, 18 ), ( 55, 30, 15 ), ( 55, 35, 12 ), ( 55, 40, 9 ), ( 55, 45, 6 ), ( 55, 50, 3 ),

( 60, 0, 36 ), ( 60, 5, 33 ), ( 60, 10, 30 ), ( 60, 15, 27 ), ( 60, 20, 24 ), ( 60, 25, 21 ), ( 60, 30, 18 ), ( 60, 35, 15 ), ( 60, 40, 12 ), ( 60, 45, 9 ), ( 60, 50, 6 ), ( 60, 55, 3 ),

( 65, 0, 39 ), ( 65, 5, 36 ), ( 65, 10, 33 ), ( 65, 15, 30 ), ( 65, 20, 27 ), ( 65, 25, 24 ), ( 65, 30, 21 ), ( 65, 35, 18 ), ( 65, 40, 15 ), ( 65, 45, 12 ), ( 65, 50, 9 ), ( 65, 55, 6 ), ( 65, 60, 3 ),

( 70, 0, 42 ), ( 70, 5, 39 ), ( 70, 10, 36 ), ( 70, 15, 33 ), ( 70, 20, 30 ), ( 70, 25, 27 ), ( 70, 30, 24 ), ( 70, 35, 21 ), ( 70, 40, 18 ), ( 70, 45, 15 ), ( 70, 50, 12 ), ( 70, 55, 9 ), ( 70, 60, 6 ), ( 70, 65, 3 ),

...

}

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)