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

( 43, 0, 15 ),

( 86, 0, 30 ), ( 86, 43, 15 ),

( 129, 0, 45 ), ( 129, 43, 30 ), ( 129, 86, 15 ),

( 172, 0, 60 ), ( 172, 43, 45 ), ( 172, 86, 30 ), ( 172, 129, 15 ),

( 215, 0, 75 ), ( 215, 43, 60 ), ( 215, 86, 45 ), ( 215, 129, 30 ), ( 215, 172, 15 ),

( 258, 0, 90 ), ( 258, 43, 75 ), ( 258, 86, 60 ), ( 258, 129, 45 ), ( 258, 172, 30 ), ( 258, 215, 15 ),

( 301, 0, 105 ), ( 301, 43, 90 ), ( 301, 86, 75 ), ( 301, 129, 60 ), ( 301, 172, 45 ), ( 301, 215, 30 ), ( 301, 258, 15 ),

( 344, 0, 120 ), ( 344, 43, 105 ), ( 344, 86, 90 ), ( 344, 129, 75 ), ( 344, 172, 60 ), ( 344, 215, 45 ), ( 344, 258, 30 ), ( 344, 301, 15 ),

( 387, 0, 135 ), ( 387, 43, 120 ), ( 387, 86, 105 ), ( 387, 129, 90 ), ( 387, 172, 75 ), ( 387, 215, 60 ), ( 387, 258, 45 ), ( 387, 301, 30 ), ( 387, 344, 15 ),

( 430, 0, 150 ), ( 430, 43, 135 ), ( 430, 86, 120 ), ( 430, 129, 105 ), ( 430, 172, 90 ), ( 430, 215, 75 ), ( 430, 258, 60 ), ( 430, 301, 45 ), ( 430, 344, 30 ), ( 430, 387, 15 ),

( 473, 0, 165 ), ( 473, 43, 150 ), ( 473, 86, 135 ), ( 473, 129, 120 ), ( 473, 172, 105 ), ( 473, 215, 90 ), ( 473, 258, 75 ), ( 473, 301, 60 ), ( 473, 344, 45 ), ( 473, 387, 30 ), ( 473, 430, 15 ),

( 516, 0, 180 ), ( 516, 43, 165 ), ( 516, 86, 150 ), ( 516, 129, 135 ), ( 516, 172, 120 ), ( 516, 215, 105 ), ( 516, 258, 90 ), ( 516, 301, 75 ), ( 516, 344, 60 ), ( 516, 387, 45 ), ( 516, 430, 30 ), ( 516, 473, 15 ),

( 559, 0, 195 ), ( 559, 43, 180 ), ( 559, 86, 165 ), ( 559, 129, 150 ), ( 559, 172, 135 ), ( 559, 215, 120 ), ( 559, 258, 105 ), ( 559, 301, 90 ), ( 559, 344, 75 ), ( 559, 387, 60 ), ( 559, 430, 45 ), ( 559, 473, 30 ), ( 559, 516, 15 ),

( 602, 0, 210 ), ( 602, 43, 195 ), ( 602, 86, 180 ), ( 602, 129, 165 ), ( 602, 172, 150 ), ( 602, 215, 135 ), ( 602, 258, 120 ), ( 602, 301, 105 ), ( 602, 344, 90 ), ( 602, 387, 75 ), ( 602, 430, 60 ), ( 602, 473, 45 ), ( 602, 516, 30 ), ( 602, 559, 15 ),

...

}

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)