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

36/17 = (36-0)/17 = {

( 36, 0, 17 ),

( 72, 0, 34 ), ( 72, 36, 17 ),

( 108, 0, 51 ), ( 108, 36, 34 ), ( 108, 72, 17 ),

( 144, 0, 68 ), ( 144, 36, 51 ), ( 144, 72, 34 ), ( 144, 108, 17 ),

( 180, 0, 85 ), ( 180, 36, 68 ), ( 180, 72, 51 ), ( 180, 108, 34 ), ( 180, 144, 17 ),

( 216, 0, 102 ), ( 216, 36, 85 ), ( 216, 72, 68 ), ( 216, 108, 51 ), ( 216, 144, 34 ), ( 216, 180, 17 ),

( 252, 0, 119 ), ( 252, 36, 102 ), ( 252, 72, 85 ), ( 252, 108, 68 ), ( 252, 144, 51 ), ( 252, 180, 34 ), ( 252, 216, 17 ),

( 288, 0, 136 ), ( 288, 36, 119 ), ( 288, 72, 102 ), ( 288, 108, 85 ), ( 288, 144, 68 ), ( 288, 180, 51 ), ( 288, 216, 34 ), ( 288, 252, 17 ),

( 324, 0, 153 ), ( 324, 36, 136 ), ( 324, 72, 119 ), ( 324, 108, 102 ), ( 324, 144, 85 ), ( 324, 180, 68 ), ( 324, 216, 51 ), ( 324, 252, 34 ), ( 324, 288, 17 ),

( 360, 0, 170 ), ( 360, 36, 153 ), ( 360, 72, 136 ), ( 360, 108, 119 ), ( 360, 144, 102 ), ( 360, 180, 85 ), ( 360, 216, 68 ), ( 360, 252, 51 ), ( 360, 288, 34 ), ( 360, 324, 17 ),

( 396, 0, 187 ), ( 396, 36, 170 ), ( 396, 72, 153 ), ( 396, 108, 136 ), ( 396, 144, 119 ), ( 396, 180, 102 ), ( 396, 216, 85 ), ( 396, 252, 68 ), ( 396, 288, 51 ), ( 396, 324, 34 ), ( 396, 360, 17 ),

( 432, 0, 204 ), ( 432, 36, 187 ), ( 432, 72, 170 ), ( 432, 108, 153 ), ( 432, 144, 136 ), ( 432, 180, 119 ), ( 432, 216, 102 ), ( 432, 252, 85 ), ( 432, 288, 68 ), ( 432, 324, 51 ), ( 432, 360, 34 ), ( 432, 396, 17 ),

( 468, 0, 221 ), ( 468, 36, 204 ), ( 468, 72, 187 ), ( 468, 108, 170 ), ( 468, 144, 153 ), ( 468, 180, 136 ), ( 468, 216, 119 ), ( 468, 252, 102 ), ( 468, 288, 85 ), ( 468, 324, 68 ), ( 468, 360, 51 ), ( 468, 396, 34 ), ( 468, 432, 17 ),

( 504, 0, 238 ), ( 504, 36, 221 ), ( 504, 72, 204 ), ( 504, 108, 187 ), ( 504, 144, 170 ), ( 504, 180, 153 ), ( 504, 216, 136 ), ( 504, 252, 119 ), ( 504, 288, 102 ), ( 504, 324, 85 ), ( 504, 360, 68 ), ( 504, 396, 51 ), ( 504, 432, 34 ), ( 504, 468, 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)