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

( 43, 0, 14 ),

( 86, 0, 28 ), ( 86, 43, 14 ),

( 129, 0, 42 ), ( 129, 43, 28 ), ( 129, 86, 14 ),

( 172, 0, 56 ), ( 172, 43, 42 ), ( 172, 86, 28 ), ( 172, 129, 14 ),

( 215, 0, 70 ), ( 215, 43, 56 ), ( 215, 86, 42 ), ( 215, 129, 28 ), ( 215, 172, 14 ),

( 258, 0, 84 ), ( 258, 43, 70 ), ( 258, 86, 56 ), ( 258, 129, 42 ), ( 258, 172, 28 ), ( 258, 215, 14 ),

( 301, 0, 98 ), ( 301, 43, 84 ), ( 301, 86, 70 ), ( 301, 129, 56 ), ( 301, 172, 42 ), ( 301, 215, 28 ), ( 301, 258, 14 ),

( 344, 0, 112 ), ( 344, 43, 98 ), ( 344, 86, 84 ), ( 344, 129, 70 ), ( 344, 172, 56 ), ( 344, 215, 42 ), ( 344, 258, 28 ), ( 344, 301, 14 ),

( 387, 0, 126 ), ( 387, 43, 112 ), ( 387, 86, 98 ), ( 387, 129, 84 ), ( 387, 172, 70 ), ( 387, 215, 56 ), ( 387, 258, 42 ), ( 387, 301, 28 ), ( 387, 344, 14 ),

( 430, 0, 140 ), ( 430, 43, 126 ), ( 430, 86, 112 ), ( 430, 129, 98 ), ( 430, 172, 84 ), ( 430, 215, 70 ), ( 430, 258, 56 ), ( 430, 301, 42 ), ( 430, 344, 28 ), ( 430, 387, 14 ),

( 473, 0, 154 ), ( 473, 43, 140 ), ( 473, 86, 126 ), ( 473, 129, 112 ), ( 473, 172, 98 ), ( 473, 215, 84 ), ( 473, 258, 70 ), ( 473, 301, 56 ), ( 473, 344, 42 ), ( 473, 387, 28 ), ( 473, 430, 14 ),

( 516, 0, 168 ), ( 516, 43, 154 ), ( 516, 86, 140 ), ( 516, 129, 126 ), ( 516, 172, 112 ), ( 516, 215, 98 ), ( 516, 258, 84 ), ( 516, 301, 70 ), ( 516, 344, 56 ), ( 516, 387, 42 ), ( 516, 430, 28 ), ( 516, 473, 14 ),

( 559, 0, 182 ), ( 559, 43, 168 ), ( 559, 86, 154 ), ( 559, 129, 140 ), ( 559, 172, 126 ), ( 559, 215, 112 ), ( 559, 258, 98 ), ( 559, 301, 84 ), ( 559, 344, 70 ), ( 559, 387, 56 ), ( 559, 430, 42 ), ( 559, 473, 28 ), ( 559, 516, 14 ),

( 602, 0, 196 ), ( 602, 43, 182 ), ( 602, 86, 168 ), ( 602, 129, 154 ), ( 602, 172, 140 ), ( 602, 215, 126 ), ( 602, 258, 112 ), ( 602, 301, 98 ), ( 602, 344, 84 ), ( 602, 387, 70 ), ( 602, 430, 56 ), ( 602, 473, 42 ), ( 602, 516, 28 ), ( 602, 559, 14 ),

...

}

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)