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

( 43, 0, 26 ),

( 86, 0, 52 ), ( 86, 43, 26 ),

( 129, 0, 78 ), ( 129, 43, 52 ), ( 129, 86, 26 ),

( 172, 0, 104 ), ( 172, 43, 78 ), ( 172, 86, 52 ), ( 172, 129, 26 ),

( 215, 0, 130 ), ( 215, 43, 104 ), ( 215, 86, 78 ), ( 215, 129, 52 ), ( 215, 172, 26 ),

( 258, 0, 156 ), ( 258, 43, 130 ), ( 258, 86, 104 ), ( 258, 129, 78 ), ( 258, 172, 52 ), ( 258, 215, 26 ),

( 301, 0, 182 ), ( 301, 43, 156 ), ( 301, 86, 130 ), ( 301, 129, 104 ), ( 301, 172, 78 ), ( 301, 215, 52 ), ( 301, 258, 26 ),

( 344, 0, 208 ), ( 344, 43, 182 ), ( 344, 86, 156 ), ( 344, 129, 130 ), ( 344, 172, 104 ), ( 344, 215, 78 ), ( 344, 258, 52 ), ( 344, 301, 26 ),

( 387, 0, 234 ), ( 387, 43, 208 ), ( 387, 86, 182 ), ( 387, 129, 156 ), ( 387, 172, 130 ), ( 387, 215, 104 ), ( 387, 258, 78 ), ( 387, 301, 52 ), ( 387, 344, 26 ),

( 430, 0, 260 ), ( 430, 43, 234 ), ( 430, 86, 208 ), ( 430, 129, 182 ), ( 430, 172, 156 ), ( 430, 215, 130 ), ( 430, 258, 104 ), ( 430, 301, 78 ), ( 430, 344, 52 ), ( 430, 387, 26 ),

( 473, 0, 286 ), ( 473, 43, 260 ), ( 473, 86, 234 ), ( 473, 129, 208 ), ( 473, 172, 182 ), ( 473, 215, 156 ), ( 473, 258, 130 ), ( 473, 301, 104 ), ( 473, 344, 78 ), ( 473, 387, 52 ), ( 473, 430, 26 ),

( 516, 0, 312 ), ( 516, 43, 286 ), ( 516, 86, 260 ), ( 516, 129, 234 ), ( 516, 172, 208 ), ( 516, 215, 182 ), ( 516, 258, 156 ), ( 516, 301, 130 ), ( 516, 344, 104 ), ( 516, 387, 78 ), ( 516, 430, 52 ), ( 516, 473, 26 ),

( 559, 0, 338 ), ( 559, 43, 312 ), ( 559, 86, 286 ), ( 559, 129, 260 ), ( 559, 172, 234 ), ( 559, 215, 208 ), ( 559, 258, 182 ), ( 559, 301, 156 ), ( 559, 344, 130 ), ( 559, 387, 104 ), ( 559, 430, 78 ), ( 559, 473, 52 ), ( 559, 516, 26 ),

( 602, 0, 364 ), ( 602, 43, 338 ), ( 602, 86, 312 ), ( 602, 129, 286 ), ( 602, 172, 260 ), ( 602, 215, 234 ), ( 602, 258, 208 ), ( 602, 301, 182 ), ( 602, 344, 156 ), ( 602, 387, 130 ), ( 602, 430, 104 ), ( 602, 473, 78 ), ( 602, 516, 52 ), ( 602, 559, 26 ),

...

}

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)