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

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

( 11, 0, 5 ),

( 22, 0, 10 ), ( 22, 11, 5 ),

( 33, 0, 15 ), ( 33, 11, 10 ), ( 33, 22, 5 ),

( 44, 0, 20 ), ( 44, 11, 15 ), ( 44, 22, 10 ), ( 44, 33, 5 ),

( 55, 0, 25 ), ( 55, 11, 20 ), ( 55, 22, 15 ), ( 55, 33, 10 ), ( 55, 44, 5 ),

( 66, 0, 30 ), ( 66, 11, 25 ), ( 66, 22, 20 ), ( 66, 33, 15 ), ( 66, 44, 10 ), ( 66, 55, 5 ),

( 77, 0, 35 ), ( 77, 11, 30 ), ( 77, 22, 25 ), ( 77, 33, 20 ), ( 77, 44, 15 ), ( 77, 55, 10 ), ( 77, 66, 5 ),

( 88, 0, 40 ), ( 88, 11, 35 ), ( 88, 22, 30 ), ( 88, 33, 25 ), ( 88, 44, 20 ), ( 88, 55, 15 ), ( 88, 66, 10 ), ( 88, 77, 5 ),

( 99, 0, 45 ), ( 99, 11, 40 ), ( 99, 22, 35 ), ( 99, 33, 30 ), ( 99, 44, 25 ), ( 99, 55, 20 ), ( 99, 66, 15 ), ( 99, 77, 10 ), ( 99, 88, 5 ),

( 110, 0, 50 ), ( 110, 11, 45 ), ( 110, 22, 40 ), ( 110, 33, 35 ), ( 110, 44, 30 ), ( 110, 55, 25 ), ( 110, 66, 20 ), ( 110, 77, 15 ), ( 110, 88, 10 ), ( 110, 99, 5 ),

( 121, 0, 55 ), ( 121, 11, 50 ), ( 121, 22, 45 ), ( 121, 33, 40 ), ( 121, 44, 35 ), ( 121, 55, 30 ), ( 121, 66, 25 ), ( 121, 77, 20 ), ( 121, 88, 15 ), ( 121, 99, 10 ), ( 121, 110, 5 ),

( 132, 0, 60 ), ( 132, 11, 55 ), ( 132, 22, 50 ), ( 132, 33, 45 ), ( 132, 44, 40 ), ( 132, 55, 35 ), ( 132, 66, 30 ), ( 132, 77, 25 ), ( 132, 88, 20 ), ( 132, 99, 15 ), ( 132, 110, 10 ), ( 132, 121, 5 ),

( 143, 0, 65 ), ( 143, 11, 60 ), ( 143, 22, 55 ), ( 143, 33, 50 ), ( 143, 44, 45 ), ( 143, 55, 40 ), ( 143, 66, 35 ), ( 143, 77, 30 ), ( 143, 88, 25 ), ( 143, 99, 20 ), ( 143, 110, 15 ), ( 143, 121, 10 ), ( 143, 132, 5 ),

( 154, 0, 70 ), ( 154, 11, 65 ), ( 154, 22, 60 ), ( 154, 33, 55 ), ( 154, 44, 50 ), ( 154, 55, 45 ), ( 154, 66, 40 ), ( 154, 77, 35 ), ( 154, 88, 30 ), ( 154, 99, 25 ), ( 154, 110, 20 ), ( 154, 121, 15 ), ( 154, 132, 10 ), ( 154, 143, 5 ),

...

}

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)