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

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

( 43, 0, 17 ),

( 86, 0, 34 ), ( 86, 43, 17 ),

( 129, 0, 51 ), ( 129, 43, 34 ), ( 129, 86, 17 ),

( 172, 0, 68 ), ( 172, 43, 51 ), ( 172, 86, 34 ), ( 172, 129, 17 ),

( 215, 0, 85 ), ( 215, 43, 68 ), ( 215, 86, 51 ), ( 215, 129, 34 ), ( 215, 172, 17 ),

( 258, 0, 102 ), ( 258, 43, 85 ), ( 258, 86, 68 ), ( 258, 129, 51 ), ( 258, 172, 34 ), ( 258, 215, 17 ),

( 301, 0, 119 ), ( 301, 43, 102 ), ( 301, 86, 85 ), ( 301, 129, 68 ), ( 301, 172, 51 ), ( 301, 215, 34 ), ( 301, 258, 17 ),

( 344, 0, 136 ), ( 344, 43, 119 ), ( 344, 86, 102 ), ( 344, 129, 85 ), ( 344, 172, 68 ), ( 344, 215, 51 ), ( 344, 258, 34 ), ( 344, 301, 17 ),

( 387, 0, 153 ), ( 387, 43, 136 ), ( 387, 86, 119 ), ( 387, 129, 102 ), ( 387, 172, 85 ), ( 387, 215, 68 ), ( 387, 258, 51 ), ( 387, 301, 34 ), ( 387, 344, 17 ),

( 430, 0, 170 ), ( 430, 43, 153 ), ( 430, 86, 136 ), ( 430, 129, 119 ), ( 430, 172, 102 ), ( 430, 215, 85 ), ( 430, 258, 68 ), ( 430, 301, 51 ), ( 430, 344, 34 ), ( 430, 387, 17 ),

( 473, 0, 187 ), ( 473, 43, 170 ), ( 473, 86, 153 ), ( 473, 129, 136 ), ( 473, 172, 119 ), ( 473, 215, 102 ), ( 473, 258, 85 ), ( 473, 301, 68 ), ( 473, 344, 51 ), ( 473, 387, 34 ), ( 473, 430, 17 ),

( 516, 0, 204 ), ( 516, 43, 187 ), ( 516, 86, 170 ), ( 516, 129, 153 ), ( 516, 172, 136 ), ( 516, 215, 119 ), ( 516, 258, 102 ), ( 516, 301, 85 ), ( 516, 344, 68 ), ( 516, 387, 51 ), ( 516, 430, 34 ), ( 516, 473, 17 ),

( 559, 0, 221 ), ( 559, 43, 204 ), ( 559, 86, 187 ), ( 559, 129, 170 ), ( 559, 172, 153 ), ( 559, 215, 136 ), ( 559, 258, 119 ), ( 559, 301, 102 ), ( 559, 344, 85 ), ( 559, 387, 68 ), ( 559, 430, 51 ), ( 559, 473, 34 ), ( 559, 516, 17 ),

( 602, 0, 238 ), ( 602, 43, 221 ), ( 602, 86, 204 ), ( 602, 129, 187 ), ( 602, 172, 170 ), ( 602, 215, 153 ), ( 602, 258, 136 ), ( 602, 301, 119 ), ( 602, 344, 102 ), ( 602, 387, 85 ), ( 602, 430, 68 ), ( 602, 473, 51 ), ( 602, 516, 34 ), ( 602, 559, 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)