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

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

( 10, 0, 3 ),

( 20, 0, 6 ), ( 20, 10, 3 ),

( 30, 0, 9 ), ( 30, 10, 6 ), ( 30, 20, 3 ),

( 40, 0, 12 ), ( 40, 10, 9 ), ( 40, 20, 6 ), ( 40, 30, 3 ),

( 50, 0, 15 ), ( 50, 10, 12 ), ( 50, 20, 9 ), ( 50, 30, 6 ), ( 50, 40, 3 ),

( 60, 0, 18 ), ( 60, 10, 15 ), ( 60, 20, 12 ), ( 60, 30, 9 ), ( 60, 40, 6 ), ( 60, 50, 3 ),

( 70, 0, 21 ), ( 70, 10, 18 ), ( 70, 20, 15 ), ( 70, 30, 12 ), ( 70, 40, 9 ), ( 70, 50, 6 ), ( 70, 60, 3 ),

( 80, 0, 24 ), ( 80, 10, 21 ), ( 80, 20, 18 ), ( 80, 30, 15 ), ( 80, 40, 12 ), ( 80, 50, 9 ), ( 80, 60, 6 ), ( 80, 70, 3 ),

( 90, 0, 27 ), ( 90, 10, 24 ), ( 90, 20, 21 ), ( 90, 30, 18 ), ( 90, 40, 15 ), ( 90, 50, 12 ), ( 90, 60, 9 ), ( 90, 70, 6 ), ( 90, 80, 3 ),

( 100, 0, 30 ), ( 100, 10, 27 ), ( 100, 20, 24 ), ( 100, 30, 21 ), ( 100, 40, 18 ), ( 100, 50, 15 ), ( 100, 60, 12 ), ( 100, 70, 9 ), ( 100, 80, 6 ), ( 100, 90, 3 ),

( 110, 0, 33 ), ( 110, 10, 30 ), ( 110, 20, 27 ), ( 110, 30, 24 ), ( 110, 40, 21 ), ( 110, 50, 18 ), ( 110, 60, 15 ), ( 110, 70, 12 ), ( 110, 80, 9 ), ( 110, 90, 6 ), ( 110, 100, 3 ),

( 120, 0, 36 ), ( 120, 10, 33 ), ( 120, 20, 30 ), ( 120, 30, 27 ), ( 120, 40, 24 ), ( 120, 50, 21 ), ( 120, 60, 18 ), ( 120, 70, 15 ), ( 120, 80, 12 ), ( 120, 90, 9 ), ( 120, 100, 6 ), ( 120, 110, 3 ),

( 130, 0, 39 ), ( 130, 10, 36 ), ( 130, 20, 33 ), ( 130, 30, 30 ), ( 130, 40, 27 ), ( 130, 50, 24 ), ( 130, 60, 21 ), ( 130, 70, 18 ), ( 130, 80, 15 ), ( 130, 90, 12 ), ( 130, 100, 9 ), ( 130, 110, 6 ), ( 130, 120, 3 ),

( 140, 0, 42 ), ( 140, 10, 39 ), ( 140, 20, 36 ), ( 140, 30, 33 ), ( 140, 40, 30 ), ( 140, 50, 27 ), ( 140, 60, 24 ), ( 140, 70, 21 ), ( 140, 80, 18 ), ( 140, 90, 15 ), ( 140, 100, 12 ), ( 140, 110, 9 ), ( 140, 120, 6 ), ( 140, 130, 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)