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

( 33, 0, 19 ),

( 66, 0, 38 ), ( 66, 33, 19 ),

( 99, 0, 57 ), ( 99, 33, 38 ), ( 99, 66, 19 ),

( 132, 0, 76 ), ( 132, 33, 57 ), ( 132, 66, 38 ), ( 132, 99, 19 ),

( 165, 0, 95 ), ( 165, 33, 76 ), ( 165, 66, 57 ), ( 165, 99, 38 ), ( 165, 132, 19 ),

( 198, 0, 114 ), ( 198, 33, 95 ), ( 198, 66, 76 ), ( 198, 99, 57 ), ( 198, 132, 38 ), ( 198, 165, 19 ),

( 231, 0, 133 ), ( 231, 33, 114 ), ( 231, 66, 95 ), ( 231, 99, 76 ), ( 231, 132, 57 ), ( 231, 165, 38 ), ( 231, 198, 19 ),

( 264, 0, 152 ), ( 264, 33, 133 ), ( 264, 66, 114 ), ( 264, 99, 95 ), ( 264, 132, 76 ), ( 264, 165, 57 ), ( 264, 198, 38 ), ( 264, 231, 19 ),

( 297, 0, 171 ), ( 297, 33, 152 ), ( 297, 66, 133 ), ( 297, 99, 114 ), ( 297, 132, 95 ), ( 297, 165, 76 ), ( 297, 198, 57 ), ( 297, 231, 38 ), ( 297, 264, 19 ),

( 330, 0, 190 ), ( 330, 33, 171 ), ( 330, 66, 152 ), ( 330, 99, 133 ), ( 330, 132, 114 ), ( 330, 165, 95 ), ( 330, 198, 76 ), ( 330, 231, 57 ), ( 330, 264, 38 ), ( 330, 297, 19 ),

( 363, 0, 209 ), ( 363, 33, 190 ), ( 363, 66, 171 ), ( 363, 99, 152 ), ( 363, 132, 133 ), ( 363, 165, 114 ), ( 363, 198, 95 ), ( 363, 231, 76 ), ( 363, 264, 57 ), ( 363, 297, 38 ), ( 363, 330, 19 ),

( 396, 0, 228 ), ( 396, 33, 209 ), ( 396, 66, 190 ), ( 396, 99, 171 ), ( 396, 132, 152 ), ( 396, 165, 133 ), ( 396, 198, 114 ), ( 396, 231, 95 ), ( 396, 264, 76 ), ( 396, 297, 57 ), ( 396, 330, 38 ), ( 396, 363, 19 ),

( 429, 0, 247 ), ( 429, 33, 228 ), ( 429, 66, 209 ), ( 429, 99, 190 ), ( 429, 132, 171 ), ( 429, 165, 152 ), ( 429, 198, 133 ), ( 429, 231, 114 ), ( 429, 264, 95 ), ( 429, 297, 76 ), ( 429, 330, 57 ), ( 429, 363, 38 ), ( 429, 396, 19 ),

( 462, 0, 266 ), ( 462, 33, 247 ), ( 462, 66, 228 ), ( 462, 99, 209 ), ( 462, 132, 190 ), ( 462, 165, 171 ), ( 462, 198, 152 ), ( 462, 231, 133 ), ( 462, 264, 114 ), ( 462, 297, 95 ), ( 462, 330, 76 ), ( 462, 363, 57 ), ( 462, 396, 38 ), ( 462, 429, 19 ),

...

}

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)