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

( 50, 0, 31 ),

( 100, 0, 62 ), ( 100, 50, 31 ),

( 150, 0, 93 ), ( 150, 50, 62 ), ( 150, 100, 31 ),

( 200, 0, 124 ), ( 200, 50, 93 ), ( 200, 100, 62 ), ( 200, 150, 31 ),

( 250, 0, 155 ), ( 250, 50, 124 ), ( 250, 100, 93 ), ( 250, 150, 62 ), ( 250, 200, 31 ),

( 300, 0, 186 ), ( 300, 50, 155 ), ( 300, 100, 124 ), ( 300, 150, 93 ), ( 300, 200, 62 ), ( 300, 250, 31 ),

( 350, 0, 217 ), ( 350, 50, 186 ), ( 350, 100, 155 ), ( 350, 150, 124 ), ( 350, 200, 93 ), ( 350, 250, 62 ), ( 350, 300, 31 ),

( 400, 0, 248 ), ( 400, 50, 217 ), ( 400, 100, 186 ), ( 400, 150, 155 ), ( 400, 200, 124 ), ( 400, 250, 93 ), ( 400, 300, 62 ), ( 400, 350, 31 ),

( 450, 0, 279 ), ( 450, 50, 248 ), ( 450, 100, 217 ), ( 450, 150, 186 ), ( 450, 200, 155 ), ( 450, 250, 124 ), ( 450, 300, 93 ), ( 450, 350, 62 ), ( 450, 400, 31 ),

( 500, 0, 310 ), ( 500, 50, 279 ), ( 500, 100, 248 ), ( 500, 150, 217 ), ( 500, 200, 186 ), ( 500, 250, 155 ), ( 500, 300, 124 ), ( 500, 350, 93 ), ( 500, 400, 62 ), ( 500, 450, 31 ),

( 550, 0, 341 ), ( 550, 50, 310 ), ( 550, 100, 279 ), ( 550, 150, 248 ), ( 550, 200, 217 ), ( 550, 250, 186 ), ( 550, 300, 155 ), ( 550, 350, 124 ), ( 550, 400, 93 ), ( 550, 450, 62 ), ( 550, 500, 31 ),

( 600, 0, 372 ), ( 600, 50, 341 ), ( 600, 100, 310 ), ( 600, 150, 279 ), ( 600, 200, 248 ), ( 600, 250, 217 ), ( 600, 300, 186 ), ( 600, 350, 155 ), ( 600, 400, 124 ), ( 600, 450, 93 ), ( 600, 500, 62 ), ( 600, 550, 31 ),

( 650, 0, 403 ), ( 650, 50, 372 ), ( 650, 100, 341 ), ( 650, 150, 310 ), ( 650, 200, 279 ), ( 650, 250, 248 ), ( 650, 300, 217 ), ( 650, 350, 186 ), ( 650, 400, 155 ), ( 650, 450, 124 ), ( 650, 500, 93 ), ( 650, 550, 62 ), ( 650, 600, 31 ),

( 700, 0, 434 ), ( 700, 50, 403 ), ( 700, 100, 372 ), ( 700, 150, 341 ), ( 700, 200, 310 ), ( 700, 250, 279 ), ( 700, 300, 248 ), ( 700, 350, 217 ), ( 700, 400, 186 ), ( 700, 450, 155 ), ( 700, 500, 124 ), ( 700, 550, 93 ), ( 700, 600, 62 ), ( 700, 650, 31 ),

...

}

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)