The rational number 46/9 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.

46/9 = (46-0)/9 = {

( 46, 0, 9 ),

( 92, 0, 18 ), ( 92, 46, 9 ),

( 138, 0, 27 ), ( 138, 46, 18 ), ( 138, 92, 9 ),

( 184, 0, 36 ), ( 184, 46, 27 ), ( 184, 92, 18 ), ( 184, 138, 9 ),

( 230, 0, 45 ), ( 230, 46, 36 ), ( 230, 92, 27 ), ( 230, 138, 18 ), ( 230, 184, 9 ),

( 276, 0, 54 ), ( 276, 46, 45 ), ( 276, 92, 36 ), ( 276, 138, 27 ), ( 276, 184, 18 ), ( 276, 230, 9 ),

( 322, 0, 63 ), ( 322, 46, 54 ), ( 322, 92, 45 ), ( 322, 138, 36 ), ( 322, 184, 27 ), ( 322, 230, 18 ), ( 322, 276, 9 ),

( 368, 0, 72 ), ( 368, 46, 63 ), ( 368, 92, 54 ), ( 368, 138, 45 ), ( 368, 184, 36 ), ( 368, 230, 27 ), ( 368, 276, 18 ), ( 368, 322, 9 ),

( 414, 0, 81 ), ( 414, 46, 72 ), ( 414, 92, 63 ), ( 414, 138, 54 ), ( 414, 184, 45 ), ( 414, 230, 36 ), ( 414, 276, 27 ), ( 414, 322, 18 ), ( 414, 368, 9 ),

( 460, 0, 90 ), ( 460, 46, 81 ), ( 460, 92, 72 ), ( 460, 138, 63 ), ( 460, 184, 54 ), ( 460, 230, 45 ), ( 460, 276, 36 ), ( 460, 322, 27 ), ( 460, 368, 18 ), ( 460, 414, 9 ),

( 506, 0, 99 ), ( 506, 46, 90 ), ( 506, 92, 81 ), ( 506, 138, 72 ), ( 506, 184, 63 ), ( 506, 230, 54 ), ( 506, 276, 45 ), ( 506, 322, 36 ), ( 506, 368, 27 ), ( 506, 414, 18 ), ( 506, 460, 9 ),

( 552, 0, 108 ), ( 552, 46, 99 ), ( 552, 92, 90 ), ( 552, 138, 81 ), ( 552, 184, 72 ), ( 552, 230, 63 ), ( 552, 276, 54 ), ( 552, 322, 45 ), ( 552, 368, 36 ), ( 552, 414, 27 ), ( 552, 460, 18 ), ( 552, 506, 9 ),

( 598, 0, 117 ), ( 598, 46, 108 ), ( 598, 92, 99 ), ( 598, 138, 90 ), ( 598, 184, 81 ), ( 598, 230, 72 ), ( 598, 276, 63 ), ( 598, 322, 54 ), ( 598, 368, 45 ), ( 598, 414, 36 ), ( 598, 460, 27 ), ( 598, 506, 18 ), ( 598, 552, 9 ),

( 644, 0, 126 ), ( 644, 46, 117 ), ( 644, 92, 108 ), ( 644, 138, 99 ), ( 644, 184, 90 ), ( 644, 230, 81 ), ( 644, 276, 72 ), ( 644, 322, 63 ), ( 644, 368, 54 ), ( 644, 414, 45 ), ( 644, 460, 36 ), ( 644, 506, 27 ), ( 644, 552, 18 ), ( 644, 598, 9 ),

...

}

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)