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

( 46, 0, 27 ),

( 92, 0, 54 ), ( 92, 46, 27 ),

( 138, 0, 81 ), ( 138, 46, 54 ), ( 138, 92, 27 ),

( 184, 0, 108 ), ( 184, 46, 81 ), ( 184, 92, 54 ), ( 184, 138, 27 ),

( 230, 0, 135 ), ( 230, 46, 108 ), ( 230, 92, 81 ), ( 230, 138, 54 ), ( 230, 184, 27 ),

( 276, 0, 162 ), ( 276, 46, 135 ), ( 276, 92, 108 ), ( 276, 138, 81 ), ( 276, 184, 54 ), ( 276, 230, 27 ),

( 322, 0, 189 ), ( 322, 46, 162 ), ( 322, 92, 135 ), ( 322, 138, 108 ), ( 322, 184, 81 ), ( 322, 230, 54 ), ( 322, 276, 27 ),

( 368, 0, 216 ), ( 368, 46, 189 ), ( 368, 92, 162 ), ( 368, 138, 135 ), ( 368, 184, 108 ), ( 368, 230, 81 ), ( 368, 276, 54 ), ( 368, 322, 27 ),

( 414, 0, 243 ), ( 414, 46, 216 ), ( 414, 92, 189 ), ( 414, 138, 162 ), ( 414, 184, 135 ), ( 414, 230, 108 ), ( 414, 276, 81 ), ( 414, 322, 54 ), ( 414, 368, 27 ),

( 460, 0, 270 ), ( 460, 46, 243 ), ( 460, 92, 216 ), ( 460, 138, 189 ), ( 460, 184, 162 ), ( 460, 230, 135 ), ( 460, 276, 108 ), ( 460, 322, 81 ), ( 460, 368, 54 ), ( 460, 414, 27 ),

( 506, 0, 297 ), ( 506, 46, 270 ), ( 506, 92, 243 ), ( 506, 138, 216 ), ( 506, 184, 189 ), ( 506, 230, 162 ), ( 506, 276, 135 ), ( 506, 322, 108 ), ( 506, 368, 81 ), ( 506, 414, 54 ), ( 506, 460, 27 ),

( 552, 0, 324 ), ( 552, 46, 297 ), ( 552, 92, 270 ), ( 552, 138, 243 ), ( 552, 184, 216 ), ( 552, 230, 189 ), ( 552, 276, 162 ), ( 552, 322, 135 ), ( 552, 368, 108 ), ( 552, 414, 81 ), ( 552, 460, 54 ), ( 552, 506, 27 ),

( 598, 0, 351 ), ( 598, 46, 324 ), ( 598, 92, 297 ), ( 598, 138, 270 ), ( 598, 184, 243 ), ( 598, 230, 216 ), ( 598, 276, 189 ), ( 598, 322, 162 ), ( 598, 368, 135 ), ( 598, 414, 108 ), ( 598, 460, 81 ), ( 598, 506, 54 ), ( 598, 552, 27 ),

( 644, 0, 378 ), ( 644, 46, 351 ), ( 644, 92, 324 ), ( 644, 138, 297 ), ( 644, 184, 270 ), ( 644, 230, 243 ), ( 644, 276, 216 ), ( 644, 322, 189 ), ( 644, 368, 162 ), ( 644, 414, 135 ), ( 644, 460, 108 ), ( 644, 506, 81 ), ( 644, 552, 54 ), ( 644, 598, 27 ),

...

}

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)