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

( 43, 0, 6 ),

( 86, 0, 12 ), ( 86, 43, 6 ),

( 129, 0, 18 ), ( 129, 43, 12 ), ( 129, 86, 6 ),

( 172, 0, 24 ), ( 172, 43, 18 ), ( 172, 86, 12 ), ( 172, 129, 6 ),

( 215, 0, 30 ), ( 215, 43, 24 ), ( 215, 86, 18 ), ( 215, 129, 12 ), ( 215, 172, 6 ),

( 258, 0, 36 ), ( 258, 43, 30 ), ( 258, 86, 24 ), ( 258, 129, 18 ), ( 258, 172, 12 ), ( 258, 215, 6 ),

( 301, 0, 42 ), ( 301, 43, 36 ), ( 301, 86, 30 ), ( 301, 129, 24 ), ( 301, 172, 18 ), ( 301, 215, 12 ), ( 301, 258, 6 ),

( 344, 0, 48 ), ( 344, 43, 42 ), ( 344, 86, 36 ), ( 344, 129, 30 ), ( 344, 172, 24 ), ( 344, 215, 18 ), ( 344, 258, 12 ), ( 344, 301, 6 ),

( 387, 0, 54 ), ( 387, 43, 48 ), ( 387, 86, 42 ), ( 387, 129, 36 ), ( 387, 172, 30 ), ( 387, 215, 24 ), ( 387, 258, 18 ), ( 387, 301, 12 ), ( 387, 344, 6 ),

( 430, 0, 60 ), ( 430, 43, 54 ), ( 430, 86, 48 ), ( 430, 129, 42 ), ( 430, 172, 36 ), ( 430, 215, 30 ), ( 430, 258, 24 ), ( 430, 301, 18 ), ( 430, 344, 12 ), ( 430, 387, 6 ),

( 473, 0, 66 ), ( 473, 43, 60 ), ( 473, 86, 54 ), ( 473, 129, 48 ), ( 473, 172, 42 ), ( 473, 215, 36 ), ( 473, 258, 30 ), ( 473, 301, 24 ), ( 473, 344, 18 ), ( 473, 387, 12 ), ( 473, 430, 6 ),

( 516, 0, 72 ), ( 516, 43, 66 ), ( 516, 86, 60 ), ( 516, 129, 54 ), ( 516, 172, 48 ), ( 516, 215, 42 ), ( 516, 258, 36 ), ( 516, 301, 30 ), ( 516, 344, 24 ), ( 516, 387, 18 ), ( 516, 430, 12 ), ( 516, 473, 6 ),

( 559, 0, 78 ), ( 559, 43, 72 ), ( 559, 86, 66 ), ( 559, 129, 60 ), ( 559, 172, 54 ), ( 559, 215, 48 ), ( 559, 258, 42 ), ( 559, 301, 36 ), ( 559, 344, 30 ), ( 559, 387, 24 ), ( 559, 430, 18 ), ( 559, 473, 12 ), ( 559, 516, 6 ),

( 602, 0, 84 ), ( 602, 43, 78 ), ( 602, 86, 72 ), ( 602, 129, 66 ), ( 602, 172, 60 ), ( 602, 215, 54 ), ( 602, 258, 48 ), ( 602, 301, 42 ), ( 602, 344, 36 ), ( 602, 387, 30 ), ( 602, 430, 24 ), ( 602, 473, 18 ), ( 602, 516, 12 ), ( 602, 559, 6 ),

...

}

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)