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

( 11, 0, 7 ),

( 22, 0, 14 ), ( 22, 11, 7 ),

( 33, 0, 21 ), ( 33, 11, 14 ), ( 33, 22, 7 ),

( 44, 0, 28 ), ( 44, 11, 21 ), ( 44, 22, 14 ), ( 44, 33, 7 ),

( 55, 0, 35 ), ( 55, 11, 28 ), ( 55, 22, 21 ), ( 55, 33, 14 ), ( 55, 44, 7 ),

( 66, 0, 42 ), ( 66, 11, 35 ), ( 66, 22, 28 ), ( 66, 33, 21 ), ( 66, 44, 14 ), ( 66, 55, 7 ),

( 77, 0, 49 ), ( 77, 11, 42 ), ( 77, 22, 35 ), ( 77, 33, 28 ), ( 77, 44, 21 ), ( 77, 55, 14 ), ( 77, 66, 7 ),

( 88, 0, 56 ), ( 88, 11, 49 ), ( 88, 22, 42 ), ( 88, 33, 35 ), ( 88, 44, 28 ), ( 88, 55, 21 ), ( 88, 66, 14 ), ( 88, 77, 7 ),

( 99, 0, 63 ), ( 99, 11, 56 ), ( 99, 22, 49 ), ( 99, 33, 42 ), ( 99, 44, 35 ), ( 99, 55, 28 ), ( 99, 66, 21 ), ( 99, 77, 14 ), ( 99, 88, 7 ),

( 110, 0, 70 ), ( 110, 11, 63 ), ( 110, 22, 56 ), ( 110, 33, 49 ), ( 110, 44, 42 ), ( 110, 55, 35 ), ( 110, 66, 28 ), ( 110, 77, 21 ), ( 110, 88, 14 ), ( 110, 99, 7 ),

( 121, 0, 77 ), ( 121, 11, 70 ), ( 121, 22, 63 ), ( 121, 33, 56 ), ( 121, 44, 49 ), ( 121, 55, 42 ), ( 121, 66, 35 ), ( 121, 77, 28 ), ( 121, 88, 21 ), ( 121, 99, 14 ), ( 121, 110, 7 ),

( 132, 0, 84 ), ( 132, 11, 77 ), ( 132, 22, 70 ), ( 132, 33, 63 ), ( 132, 44, 56 ), ( 132, 55, 49 ), ( 132, 66, 42 ), ( 132, 77, 35 ), ( 132, 88, 28 ), ( 132, 99, 21 ), ( 132, 110, 14 ), ( 132, 121, 7 ),

( 143, 0, 91 ), ( 143, 11, 84 ), ( 143, 22, 77 ), ( 143, 33, 70 ), ( 143, 44, 63 ), ( 143, 55, 56 ), ( 143, 66, 49 ), ( 143, 77, 42 ), ( 143, 88, 35 ), ( 143, 99, 28 ), ( 143, 110, 21 ), ( 143, 121, 14 ), ( 143, 132, 7 ),

( 154, 0, 98 ), ( 154, 11, 91 ), ( 154, 22, 84 ), ( 154, 33, 77 ), ( 154, 44, 70 ), ( 154, 55, 63 ), ( 154, 66, 56 ), ( 154, 77, 49 ), ( 154, 88, 42 ), ( 154, 99, 35 ), ( 154, 110, 28 ), ( 154, 121, 21 ), ( 154, 132, 14 ), ( 154, 143, 7 ),

...

}

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)