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

( 43, 0, 16 ),

( 86, 0, 32 ), ( 86, 43, 16 ),

( 129, 0, 48 ), ( 129, 43, 32 ), ( 129, 86, 16 ),

( 172, 0, 64 ), ( 172, 43, 48 ), ( 172, 86, 32 ), ( 172, 129, 16 ),

( 215, 0, 80 ), ( 215, 43, 64 ), ( 215, 86, 48 ), ( 215, 129, 32 ), ( 215, 172, 16 ),

( 258, 0, 96 ), ( 258, 43, 80 ), ( 258, 86, 64 ), ( 258, 129, 48 ), ( 258, 172, 32 ), ( 258, 215, 16 ),

( 301, 0, 112 ), ( 301, 43, 96 ), ( 301, 86, 80 ), ( 301, 129, 64 ), ( 301, 172, 48 ), ( 301, 215, 32 ), ( 301, 258, 16 ),

( 344, 0, 128 ), ( 344, 43, 112 ), ( 344, 86, 96 ), ( 344, 129, 80 ), ( 344, 172, 64 ), ( 344, 215, 48 ), ( 344, 258, 32 ), ( 344, 301, 16 ),

( 387, 0, 144 ), ( 387, 43, 128 ), ( 387, 86, 112 ), ( 387, 129, 96 ), ( 387, 172, 80 ), ( 387, 215, 64 ), ( 387, 258, 48 ), ( 387, 301, 32 ), ( 387, 344, 16 ),

( 430, 0, 160 ), ( 430, 43, 144 ), ( 430, 86, 128 ), ( 430, 129, 112 ), ( 430, 172, 96 ), ( 430, 215, 80 ), ( 430, 258, 64 ), ( 430, 301, 48 ), ( 430, 344, 32 ), ( 430, 387, 16 ),

( 473, 0, 176 ), ( 473, 43, 160 ), ( 473, 86, 144 ), ( 473, 129, 128 ), ( 473, 172, 112 ), ( 473, 215, 96 ), ( 473, 258, 80 ), ( 473, 301, 64 ), ( 473, 344, 48 ), ( 473, 387, 32 ), ( 473, 430, 16 ),

( 516, 0, 192 ), ( 516, 43, 176 ), ( 516, 86, 160 ), ( 516, 129, 144 ), ( 516, 172, 128 ), ( 516, 215, 112 ), ( 516, 258, 96 ), ( 516, 301, 80 ), ( 516, 344, 64 ), ( 516, 387, 48 ), ( 516, 430, 32 ), ( 516, 473, 16 ),

( 559, 0, 208 ), ( 559, 43, 192 ), ( 559, 86, 176 ), ( 559, 129, 160 ), ( 559, 172, 144 ), ( 559, 215, 128 ), ( 559, 258, 112 ), ( 559, 301, 96 ), ( 559, 344, 80 ), ( 559, 387, 64 ), ( 559, 430, 48 ), ( 559, 473, 32 ), ( 559, 516, 16 ),

( 602, 0, 224 ), ( 602, 43, 208 ), ( 602, 86, 192 ), ( 602, 129, 176 ), ( 602, 172, 160 ), ( 602, 215, 144 ), ( 602, 258, 128 ), ( 602, 301, 112 ), ( 602, 344, 96 ), ( 602, 387, 80 ), ( 602, 430, 64 ), ( 602, 473, 48 ), ( 602, 516, 32 ), ( 602, 559, 16 ),

...

}

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)