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

33/14 = (33-0)/14 = {

( 33, 0, 14 ),

( 66, 0, 28 ), ( 66, 33, 14 ),

( 99, 0, 42 ), ( 99, 33, 28 ), ( 99, 66, 14 ),

( 132, 0, 56 ), ( 132, 33, 42 ), ( 132, 66, 28 ), ( 132, 99, 14 ),

( 165, 0, 70 ), ( 165, 33, 56 ), ( 165, 66, 42 ), ( 165, 99, 28 ), ( 165, 132, 14 ),

( 198, 0, 84 ), ( 198, 33, 70 ), ( 198, 66, 56 ), ( 198, 99, 42 ), ( 198, 132, 28 ), ( 198, 165, 14 ),

( 231, 0, 98 ), ( 231, 33, 84 ), ( 231, 66, 70 ), ( 231, 99, 56 ), ( 231, 132, 42 ), ( 231, 165, 28 ), ( 231, 198, 14 ),

( 264, 0, 112 ), ( 264, 33, 98 ), ( 264, 66, 84 ), ( 264, 99, 70 ), ( 264, 132, 56 ), ( 264, 165, 42 ), ( 264, 198, 28 ), ( 264, 231, 14 ),

( 297, 0, 126 ), ( 297, 33, 112 ), ( 297, 66, 98 ), ( 297, 99, 84 ), ( 297, 132, 70 ), ( 297, 165, 56 ), ( 297, 198, 42 ), ( 297, 231, 28 ), ( 297, 264, 14 ),

( 330, 0, 140 ), ( 330, 33, 126 ), ( 330, 66, 112 ), ( 330, 99, 98 ), ( 330, 132, 84 ), ( 330, 165, 70 ), ( 330, 198, 56 ), ( 330, 231, 42 ), ( 330, 264, 28 ), ( 330, 297, 14 ),

( 363, 0, 154 ), ( 363, 33, 140 ), ( 363, 66, 126 ), ( 363, 99, 112 ), ( 363, 132, 98 ), ( 363, 165, 84 ), ( 363, 198, 70 ), ( 363, 231, 56 ), ( 363, 264, 42 ), ( 363, 297, 28 ), ( 363, 330, 14 ),

( 396, 0, 168 ), ( 396, 33, 154 ), ( 396, 66, 140 ), ( 396, 99, 126 ), ( 396, 132, 112 ), ( 396, 165, 98 ), ( 396, 198, 84 ), ( 396, 231, 70 ), ( 396, 264, 56 ), ( 396, 297, 42 ), ( 396, 330, 28 ), ( 396, 363, 14 ),

( 429, 0, 182 ), ( 429, 33, 168 ), ( 429, 66, 154 ), ( 429, 99, 140 ), ( 429, 132, 126 ), ( 429, 165, 112 ), ( 429, 198, 98 ), ( 429, 231, 84 ), ( 429, 264, 70 ), ( 429, 297, 56 ), ( 429, 330, 42 ), ( 429, 363, 28 ), ( 429, 396, 14 ),

( 462, 0, 196 ), ( 462, 33, 182 ), ( 462, 66, 168 ), ( 462, 99, 154 ), ( 462, 132, 140 ), ( 462, 165, 126 ), ( 462, 198, 112 ), ( 462, 231, 98 ), ( 462, 264, 84 ), ( 462, 297, 70 ), ( 462, 330, 56 ), ( 462, 363, 42 ), ( 462, 396, 28 ), ( 462, 429, 14 ),

...

}

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)