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

( 43, 0, 25 ),

( 86, 0, 50 ), ( 86, 43, 25 ),

( 129, 0, 75 ), ( 129, 43, 50 ), ( 129, 86, 25 ),

( 172, 0, 100 ), ( 172, 43, 75 ), ( 172, 86, 50 ), ( 172, 129, 25 ),

( 215, 0, 125 ), ( 215, 43, 100 ), ( 215, 86, 75 ), ( 215, 129, 50 ), ( 215, 172, 25 ),

( 258, 0, 150 ), ( 258, 43, 125 ), ( 258, 86, 100 ), ( 258, 129, 75 ), ( 258, 172, 50 ), ( 258, 215, 25 ),

( 301, 0, 175 ), ( 301, 43, 150 ), ( 301, 86, 125 ), ( 301, 129, 100 ), ( 301, 172, 75 ), ( 301, 215, 50 ), ( 301, 258, 25 ),

( 344, 0, 200 ), ( 344, 43, 175 ), ( 344, 86, 150 ), ( 344, 129, 125 ), ( 344, 172, 100 ), ( 344, 215, 75 ), ( 344, 258, 50 ), ( 344, 301, 25 ),

( 387, 0, 225 ), ( 387, 43, 200 ), ( 387, 86, 175 ), ( 387, 129, 150 ), ( 387, 172, 125 ), ( 387, 215, 100 ), ( 387, 258, 75 ), ( 387, 301, 50 ), ( 387, 344, 25 ),

( 430, 0, 250 ), ( 430, 43, 225 ), ( 430, 86, 200 ), ( 430, 129, 175 ), ( 430, 172, 150 ), ( 430, 215, 125 ), ( 430, 258, 100 ), ( 430, 301, 75 ), ( 430, 344, 50 ), ( 430, 387, 25 ),

( 473, 0, 275 ), ( 473, 43, 250 ), ( 473, 86, 225 ), ( 473, 129, 200 ), ( 473, 172, 175 ), ( 473, 215, 150 ), ( 473, 258, 125 ), ( 473, 301, 100 ), ( 473, 344, 75 ), ( 473, 387, 50 ), ( 473, 430, 25 ),

( 516, 0, 300 ), ( 516, 43, 275 ), ( 516, 86, 250 ), ( 516, 129, 225 ), ( 516, 172, 200 ), ( 516, 215, 175 ), ( 516, 258, 150 ), ( 516, 301, 125 ), ( 516, 344, 100 ), ( 516, 387, 75 ), ( 516, 430, 50 ), ( 516, 473, 25 ),

( 559, 0, 325 ), ( 559, 43, 300 ), ( 559, 86, 275 ), ( 559, 129, 250 ), ( 559, 172, 225 ), ( 559, 215, 200 ), ( 559, 258, 175 ), ( 559, 301, 150 ), ( 559, 344, 125 ), ( 559, 387, 100 ), ( 559, 430, 75 ), ( 559, 473, 50 ), ( 559, 516, 25 ),

( 602, 0, 350 ), ( 602, 43, 325 ), ( 602, 86, 300 ), ( 602, 129, 275 ), ( 602, 172, 250 ), ( 602, 215, 225 ), ( 602, 258, 200 ), ( 602, 301, 175 ), ( 602, 344, 150 ), ( 602, 387, 125 ), ( 602, 430, 100 ), ( 602, 473, 75 ), ( 602, 516, 50 ), ( 602, 559, 25 ),

...

}

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)