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

( 33, 0, 13 ),

( 66, 0, 26 ), ( 66, 33, 13 ),

( 99, 0, 39 ), ( 99, 33, 26 ), ( 99, 66, 13 ),

( 132, 0, 52 ), ( 132, 33, 39 ), ( 132, 66, 26 ), ( 132, 99, 13 ),

( 165, 0, 65 ), ( 165, 33, 52 ), ( 165, 66, 39 ), ( 165, 99, 26 ), ( 165, 132, 13 ),

( 198, 0, 78 ), ( 198, 33, 65 ), ( 198, 66, 52 ), ( 198, 99, 39 ), ( 198, 132, 26 ), ( 198, 165, 13 ),

( 231, 0, 91 ), ( 231, 33, 78 ), ( 231, 66, 65 ), ( 231, 99, 52 ), ( 231, 132, 39 ), ( 231, 165, 26 ), ( 231, 198, 13 ),

( 264, 0, 104 ), ( 264, 33, 91 ), ( 264, 66, 78 ), ( 264, 99, 65 ), ( 264, 132, 52 ), ( 264, 165, 39 ), ( 264, 198, 26 ), ( 264, 231, 13 ),

( 297, 0, 117 ), ( 297, 33, 104 ), ( 297, 66, 91 ), ( 297, 99, 78 ), ( 297, 132, 65 ), ( 297, 165, 52 ), ( 297, 198, 39 ), ( 297, 231, 26 ), ( 297, 264, 13 ),

( 330, 0, 130 ), ( 330, 33, 117 ), ( 330, 66, 104 ), ( 330, 99, 91 ), ( 330, 132, 78 ), ( 330, 165, 65 ), ( 330, 198, 52 ), ( 330, 231, 39 ), ( 330, 264, 26 ), ( 330, 297, 13 ),

( 363, 0, 143 ), ( 363, 33, 130 ), ( 363, 66, 117 ), ( 363, 99, 104 ), ( 363, 132, 91 ), ( 363, 165, 78 ), ( 363, 198, 65 ), ( 363, 231, 52 ), ( 363, 264, 39 ), ( 363, 297, 26 ), ( 363, 330, 13 ),

( 396, 0, 156 ), ( 396, 33, 143 ), ( 396, 66, 130 ), ( 396, 99, 117 ), ( 396, 132, 104 ), ( 396, 165, 91 ), ( 396, 198, 78 ), ( 396, 231, 65 ), ( 396, 264, 52 ), ( 396, 297, 39 ), ( 396, 330, 26 ), ( 396, 363, 13 ),

( 429, 0, 169 ), ( 429, 33, 156 ), ( 429, 66, 143 ), ( 429, 99, 130 ), ( 429, 132, 117 ), ( 429, 165, 104 ), ( 429, 198, 91 ), ( 429, 231, 78 ), ( 429, 264, 65 ), ( 429, 297, 52 ), ( 429, 330, 39 ), ( 429, 363, 26 ), ( 429, 396, 13 ),

( 462, 0, 182 ), ( 462, 33, 169 ), ( 462, 66, 156 ), ( 462, 99, 143 ), ( 462, 132, 130 ), ( 462, 165, 117 ), ( 462, 198, 104 ), ( 462, 231, 91 ), ( 462, 264, 78 ), ( 462, 297, 65 ), ( 462, 330, 52 ), ( 462, 363, 39 ), ( 462, 396, 26 ), ( 462, 429, 13 ),

...

}

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)