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

( 43, 0, 24 ),

( 86, 0, 48 ), ( 86, 43, 24 ),

( 129, 0, 72 ), ( 129, 43, 48 ), ( 129, 86, 24 ),

( 172, 0, 96 ), ( 172, 43, 72 ), ( 172, 86, 48 ), ( 172, 129, 24 ),

( 215, 0, 120 ), ( 215, 43, 96 ), ( 215, 86, 72 ), ( 215, 129, 48 ), ( 215, 172, 24 ),

( 258, 0, 144 ), ( 258, 43, 120 ), ( 258, 86, 96 ), ( 258, 129, 72 ), ( 258, 172, 48 ), ( 258, 215, 24 ),

( 301, 0, 168 ), ( 301, 43, 144 ), ( 301, 86, 120 ), ( 301, 129, 96 ), ( 301, 172, 72 ), ( 301, 215, 48 ), ( 301, 258, 24 ),

( 344, 0, 192 ), ( 344, 43, 168 ), ( 344, 86, 144 ), ( 344, 129, 120 ), ( 344, 172, 96 ), ( 344, 215, 72 ), ( 344, 258, 48 ), ( 344, 301, 24 ),

( 387, 0, 216 ), ( 387, 43, 192 ), ( 387, 86, 168 ), ( 387, 129, 144 ), ( 387, 172, 120 ), ( 387, 215, 96 ), ( 387, 258, 72 ), ( 387, 301, 48 ), ( 387, 344, 24 ),

( 430, 0, 240 ), ( 430, 43, 216 ), ( 430, 86, 192 ), ( 430, 129, 168 ), ( 430, 172, 144 ), ( 430, 215, 120 ), ( 430, 258, 96 ), ( 430, 301, 72 ), ( 430, 344, 48 ), ( 430, 387, 24 ),

( 473, 0, 264 ), ( 473, 43, 240 ), ( 473, 86, 216 ), ( 473, 129, 192 ), ( 473, 172, 168 ), ( 473, 215, 144 ), ( 473, 258, 120 ), ( 473, 301, 96 ), ( 473, 344, 72 ), ( 473, 387, 48 ), ( 473, 430, 24 ),

( 516, 0, 288 ), ( 516, 43, 264 ), ( 516, 86, 240 ), ( 516, 129, 216 ), ( 516, 172, 192 ), ( 516, 215, 168 ), ( 516, 258, 144 ), ( 516, 301, 120 ), ( 516, 344, 96 ), ( 516, 387, 72 ), ( 516, 430, 48 ), ( 516, 473, 24 ),

( 559, 0, 312 ), ( 559, 43, 288 ), ( 559, 86, 264 ), ( 559, 129, 240 ), ( 559, 172, 216 ), ( 559, 215, 192 ), ( 559, 258, 168 ), ( 559, 301, 144 ), ( 559, 344, 120 ), ( 559, 387, 96 ), ( 559, 430, 72 ), ( 559, 473, 48 ), ( 559, 516, 24 ),

( 602, 0, 336 ), ( 602, 43, 312 ), ( 602, 86, 288 ), ( 602, 129, 264 ), ( 602, 172, 240 ), ( 602, 215, 216 ), ( 602, 258, 192 ), ( 602, 301, 168 ), ( 602, 344, 144 ), ( 602, 387, 120 ), ( 602, 430, 96 ), ( 602, 473, 72 ), ( 602, 516, 48 ), ( 602, 559, 24 ),

...

}

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)