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

( 47, 0, 17 ),

( 94, 0, 34 ), ( 94, 47, 17 ),

( 141, 0, 51 ), ( 141, 47, 34 ), ( 141, 94, 17 ),

( 188, 0, 68 ), ( 188, 47, 51 ), ( 188, 94, 34 ), ( 188, 141, 17 ),

( 235, 0, 85 ), ( 235, 47, 68 ), ( 235, 94, 51 ), ( 235, 141, 34 ), ( 235, 188, 17 ),

( 282, 0, 102 ), ( 282, 47, 85 ), ( 282, 94, 68 ), ( 282, 141, 51 ), ( 282, 188, 34 ), ( 282, 235, 17 ),

( 329, 0, 119 ), ( 329, 47, 102 ), ( 329, 94, 85 ), ( 329, 141, 68 ), ( 329, 188, 51 ), ( 329, 235, 34 ), ( 329, 282, 17 ),

( 376, 0, 136 ), ( 376, 47, 119 ), ( 376, 94, 102 ), ( 376, 141, 85 ), ( 376, 188, 68 ), ( 376, 235, 51 ), ( 376, 282, 34 ), ( 376, 329, 17 ),

( 423, 0, 153 ), ( 423, 47, 136 ), ( 423, 94, 119 ), ( 423, 141, 102 ), ( 423, 188, 85 ), ( 423, 235, 68 ), ( 423, 282, 51 ), ( 423, 329, 34 ), ( 423, 376, 17 ),

( 470, 0, 170 ), ( 470, 47, 153 ), ( 470, 94, 136 ), ( 470, 141, 119 ), ( 470, 188, 102 ), ( 470, 235, 85 ), ( 470, 282, 68 ), ( 470, 329, 51 ), ( 470, 376, 34 ), ( 470, 423, 17 ),

( 517, 0, 187 ), ( 517, 47, 170 ), ( 517, 94, 153 ), ( 517, 141, 136 ), ( 517, 188, 119 ), ( 517, 235, 102 ), ( 517, 282, 85 ), ( 517, 329, 68 ), ( 517, 376, 51 ), ( 517, 423, 34 ), ( 517, 470, 17 ),

( 564, 0, 204 ), ( 564, 47, 187 ), ( 564, 94, 170 ), ( 564, 141, 153 ), ( 564, 188, 136 ), ( 564, 235, 119 ), ( 564, 282, 102 ), ( 564, 329, 85 ), ( 564, 376, 68 ), ( 564, 423, 51 ), ( 564, 470, 34 ), ( 564, 517, 17 ),

( 611, 0, 221 ), ( 611, 47, 204 ), ( 611, 94, 187 ), ( 611, 141, 170 ), ( 611, 188, 153 ), ( 611, 235, 136 ), ( 611, 282, 119 ), ( 611, 329, 102 ), ( 611, 376, 85 ), ( 611, 423, 68 ), ( 611, 470, 51 ), ( 611, 517, 34 ), ( 611, 564, 17 ),

( 658, 0, 238 ), ( 658, 47, 221 ), ( 658, 94, 204 ), ( 658, 141, 187 ), ( 658, 188, 170 ), ( 658, 235, 153 ), ( 658, 282, 136 ), ( 658, 329, 119 ), ( 658, 376, 102 ), ( 658, 423, 85 ), ( 658, 470, 68 ), ( 658, 517, 51 ), ( 658, 564, 34 ), ( 658, 611, 17 ),

...

}

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)