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

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

( 47, 0, 33 ),

( 94, 0, 66 ), ( 94, 47, 33 ),

( 141, 0, 99 ), ( 141, 47, 66 ), ( 141, 94, 33 ),

( 188, 0, 132 ), ( 188, 47, 99 ), ( 188, 94, 66 ), ( 188, 141, 33 ),

( 235, 0, 165 ), ( 235, 47, 132 ), ( 235, 94, 99 ), ( 235, 141, 66 ), ( 235, 188, 33 ),

( 282, 0, 198 ), ( 282, 47, 165 ), ( 282, 94, 132 ), ( 282, 141, 99 ), ( 282, 188, 66 ), ( 282, 235, 33 ),

( 329, 0, 231 ), ( 329, 47, 198 ), ( 329, 94, 165 ), ( 329, 141, 132 ), ( 329, 188, 99 ), ( 329, 235, 66 ), ( 329, 282, 33 ),

( 376, 0, 264 ), ( 376, 47, 231 ), ( 376, 94, 198 ), ( 376, 141, 165 ), ( 376, 188, 132 ), ( 376, 235, 99 ), ( 376, 282, 66 ), ( 376, 329, 33 ),

( 423, 0, 297 ), ( 423, 47, 264 ), ( 423, 94, 231 ), ( 423, 141, 198 ), ( 423, 188, 165 ), ( 423, 235, 132 ), ( 423, 282, 99 ), ( 423, 329, 66 ), ( 423, 376, 33 ),

( 470, 0, 330 ), ( 470, 47, 297 ), ( 470, 94, 264 ), ( 470, 141, 231 ), ( 470, 188, 198 ), ( 470, 235, 165 ), ( 470, 282, 132 ), ( 470, 329, 99 ), ( 470, 376, 66 ), ( 470, 423, 33 ),

( 517, 0, 363 ), ( 517, 47, 330 ), ( 517, 94, 297 ), ( 517, 141, 264 ), ( 517, 188, 231 ), ( 517, 235, 198 ), ( 517, 282, 165 ), ( 517, 329, 132 ), ( 517, 376, 99 ), ( 517, 423, 66 ), ( 517, 470, 33 ),

( 564, 0, 396 ), ( 564, 47, 363 ), ( 564, 94, 330 ), ( 564, 141, 297 ), ( 564, 188, 264 ), ( 564, 235, 231 ), ( 564, 282, 198 ), ( 564, 329, 165 ), ( 564, 376, 132 ), ( 564, 423, 99 ), ( 564, 470, 66 ), ( 564, 517, 33 ),

( 611, 0, 429 ), ( 611, 47, 396 ), ( 611, 94, 363 ), ( 611, 141, 330 ), ( 611, 188, 297 ), ( 611, 235, 264 ), ( 611, 282, 231 ), ( 611, 329, 198 ), ( 611, 376, 165 ), ( 611, 423, 132 ), ( 611, 470, 99 ), ( 611, 517, 66 ), ( 611, 564, 33 ),

( 658, 0, 462 ), ( 658, 47, 429 ), ( 658, 94, 396 ), ( 658, 141, 363 ), ( 658, 188, 330 ), ( 658, 235, 297 ), ( 658, 282, 264 ), ( 658, 329, 231 ), ( 658, 376, 198 ), ( 658, 423, 165 ), ( 658, 470, 132 ), ( 658, 517, 99 ), ( 658, 564, 66 ), ( 658, 611, 33 ),

...

}

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)