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

( 43, 0, 23 ),

( 86, 0, 46 ), ( 86, 43, 23 ),

( 129, 0, 69 ), ( 129, 43, 46 ), ( 129, 86, 23 ),

( 172, 0, 92 ), ( 172, 43, 69 ), ( 172, 86, 46 ), ( 172, 129, 23 ),

( 215, 0, 115 ), ( 215, 43, 92 ), ( 215, 86, 69 ), ( 215, 129, 46 ), ( 215, 172, 23 ),

( 258, 0, 138 ), ( 258, 43, 115 ), ( 258, 86, 92 ), ( 258, 129, 69 ), ( 258, 172, 46 ), ( 258, 215, 23 ),

( 301, 0, 161 ), ( 301, 43, 138 ), ( 301, 86, 115 ), ( 301, 129, 92 ), ( 301, 172, 69 ), ( 301, 215, 46 ), ( 301, 258, 23 ),

( 344, 0, 184 ), ( 344, 43, 161 ), ( 344, 86, 138 ), ( 344, 129, 115 ), ( 344, 172, 92 ), ( 344, 215, 69 ), ( 344, 258, 46 ), ( 344, 301, 23 ),

( 387, 0, 207 ), ( 387, 43, 184 ), ( 387, 86, 161 ), ( 387, 129, 138 ), ( 387, 172, 115 ), ( 387, 215, 92 ), ( 387, 258, 69 ), ( 387, 301, 46 ), ( 387, 344, 23 ),

( 430, 0, 230 ), ( 430, 43, 207 ), ( 430, 86, 184 ), ( 430, 129, 161 ), ( 430, 172, 138 ), ( 430, 215, 115 ), ( 430, 258, 92 ), ( 430, 301, 69 ), ( 430, 344, 46 ), ( 430, 387, 23 ),

( 473, 0, 253 ), ( 473, 43, 230 ), ( 473, 86, 207 ), ( 473, 129, 184 ), ( 473, 172, 161 ), ( 473, 215, 138 ), ( 473, 258, 115 ), ( 473, 301, 92 ), ( 473, 344, 69 ), ( 473, 387, 46 ), ( 473, 430, 23 ),

( 516, 0, 276 ), ( 516, 43, 253 ), ( 516, 86, 230 ), ( 516, 129, 207 ), ( 516, 172, 184 ), ( 516, 215, 161 ), ( 516, 258, 138 ), ( 516, 301, 115 ), ( 516, 344, 92 ), ( 516, 387, 69 ), ( 516, 430, 46 ), ( 516, 473, 23 ),

( 559, 0, 299 ), ( 559, 43, 276 ), ( 559, 86, 253 ), ( 559, 129, 230 ), ( 559, 172, 207 ), ( 559, 215, 184 ), ( 559, 258, 161 ), ( 559, 301, 138 ), ( 559, 344, 115 ), ( 559, 387, 92 ), ( 559, 430, 69 ), ( 559, 473, 46 ), ( 559, 516, 23 ),

( 602, 0, 322 ), ( 602, 43, 299 ), ( 602, 86, 276 ), ( 602, 129, 253 ), ( 602, 172, 230 ), ( 602, 215, 207 ), ( 602, 258, 184 ), ( 602, 301, 161 ), ( 602, 344, 138 ), ( 602, 387, 115 ), ( 602, 430, 92 ), ( 602, 473, 69 ), ( 602, 516, 46 ), ( 602, 559, 23 ),

...

}

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)