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

50/27 = (50-0)/27 = {

( 50, 0, 27 ),

( 100, 0, 54 ), ( 100, 50, 27 ),

( 150, 0, 81 ), ( 150, 50, 54 ), ( 150, 100, 27 ),

( 200, 0, 108 ), ( 200, 50, 81 ), ( 200, 100, 54 ), ( 200, 150, 27 ),

( 250, 0, 135 ), ( 250, 50, 108 ), ( 250, 100, 81 ), ( 250, 150, 54 ), ( 250, 200, 27 ),

( 300, 0, 162 ), ( 300, 50, 135 ), ( 300, 100, 108 ), ( 300, 150, 81 ), ( 300, 200, 54 ), ( 300, 250, 27 ),

( 350, 0, 189 ), ( 350, 50, 162 ), ( 350, 100, 135 ), ( 350, 150, 108 ), ( 350, 200, 81 ), ( 350, 250, 54 ), ( 350, 300, 27 ),

( 400, 0, 216 ), ( 400, 50, 189 ), ( 400, 100, 162 ), ( 400, 150, 135 ), ( 400, 200, 108 ), ( 400, 250, 81 ), ( 400, 300, 54 ), ( 400, 350, 27 ),

( 450, 0, 243 ), ( 450, 50, 216 ), ( 450, 100, 189 ), ( 450, 150, 162 ), ( 450, 200, 135 ), ( 450, 250, 108 ), ( 450, 300, 81 ), ( 450, 350, 54 ), ( 450, 400, 27 ),

( 500, 0, 270 ), ( 500, 50, 243 ), ( 500, 100, 216 ), ( 500, 150, 189 ), ( 500, 200, 162 ), ( 500, 250, 135 ), ( 500, 300, 108 ), ( 500, 350, 81 ), ( 500, 400, 54 ), ( 500, 450, 27 ),

( 550, 0, 297 ), ( 550, 50, 270 ), ( 550, 100, 243 ), ( 550, 150, 216 ), ( 550, 200, 189 ), ( 550, 250, 162 ), ( 550, 300, 135 ), ( 550, 350, 108 ), ( 550, 400, 81 ), ( 550, 450, 54 ), ( 550, 500, 27 ),

( 600, 0, 324 ), ( 600, 50, 297 ), ( 600, 100, 270 ), ( 600, 150, 243 ), ( 600, 200, 216 ), ( 600, 250, 189 ), ( 600, 300, 162 ), ( 600, 350, 135 ), ( 600, 400, 108 ), ( 600, 450, 81 ), ( 600, 500, 54 ), ( 600, 550, 27 ),

( 650, 0, 351 ), ( 650, 50, 324 ), ( 650, 100, 297 ), ( 650, 150, 270 ), ( 650, 200, 243 ), ( 650, 250, 216 ), ( 650, 300, 189 ), ( 650, 350, 162 ), ( 650, 400, 135 ), ( 650, 450, 108 ), ( 650, 500, 81 ), ( 650, 550, 54 ), ( 650, 600, 27 ),

( 700, 0, 378 ), ( 700, 50, 351 ), ( 700, 100, 324 ), ( 700, 150, 297 ), ( 700, 200, 270 ), ( 700, 250, 243 ), ( 700, 300, 216 ), ( 700, 350, 189 ), ( 700, 400, 162 ), ( 700, 450, 135 ), ( 700, 500, 108 ), ( 700, 550, 81 ), ( 700, 600, 54 ), ( 700, 650, 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)