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

( 50, 0, 29 ),

( 100, 0, 58 ), ( 100, 50, 29 ),

( 150, 0, 87 ), ( 150, 50, 58 ), ( 150, 100, 29 ),

( 200, 0, 116 ), ( 200, 50, 87 ), ( 200, 100, 58 ), ( 200, 150, 29 ),

( 250, 0, 145 ), ( 250, 50, 116 ), ( 250, 100, 87 ), ( 250, 150, 58 ), ( 250, 200, 29 ),

( 300, 0, 174 ), ( 300, 50, 145 ), ( 300, 100, 116 ), ( 300, 150, 87 ), ( 300, 200, 58 ), ( 300, 250, 29 ),

( 350, 0, 203 ), ( 350, 50, 174 ), ( 350, 100, 145 ), ( 350, 150, 116 ), ( 350, 200, 87 ), ( 350, 250, 58 ), ( 350, 300, 29 ),

( 400, 0, 232 ), ( 400, 50, 203 ), ( 400, 100, 174 ), ( 400, 150, 145 ), ( 400, 200, 116 ), ( 400, 250, 87 ), ( 400, 300, 58 ), ( 400, 350, 29 ),

( 450, 0, 261 ), ( 450, 50, 232 ), ( 450, 100, 203 ), ( 450, 150, 174 ), ( 450, 200, 145 ), ( 450, 250, 116 ), ( 450, 300, 87 ), ( 450, 350, 58 ), ( 450, 400, 29 ),

( 500, 0, 290 ), ( 500, 50, 261 ), ( 500, 100, 232 ), ( 500, 150, 203 ), ( 500, 200, 174 ), ( 500, 250, 145 ), ( 500, 300, 116 ), ( 500, 350, 87 ), ( 500, 400, 58 ), ( 500, 450, 29 ),

( 550, 0, 319 ), ( 550, 50, 290 ), ( 550, 100, 261 ), ( 550, 150, 232 ), ( 550, 200, 203 ), ( 550, 250, 174 ), ( 550, 300, 145 ), ( 550, 350, 116 ), ( 550, 400, 87 ), ( 550, 450, 58 ), ( 550, 500, 29 ),

( 600, 0, 348 ), ( 600, 50, 319 ), ( 600, 100, 290 ), ( 600, 150, 261 ), ( 600, 200, 232 ), ( 600, 250, 203 ), ( 600, 300, 174 ), ( 600, 350, 145 ), ( 600, 400, 116 ), ( 600, 450, 87 ), ( 600, 500, 58 ), ( 600, 550, 29 ),

( 650, 0, 377 ), ( 650, 50, 348 ), ( 650, 100, 319 ), ( 650, 150, 290 ), ( 650, 200, 261 ), ( 650, 250, 232 ), ( 650, 300, 203 ), ( 650, 350, 174 ), ( 650, 400, 145 ), ( 650, 450, 116 ), ( 650, 500, 87 ), ( 650, 550, 58 ), ( 650, 600, 29 ),

( 700, 0, 406 ), ( 700, 50, 377 ), ( 700, 100, 348 ), ( 700, 150, 319 ), ( 700, 200, 290 ), ( 700, 250, 261 ), ( 700, 300, 232 ), ( 700, 350, 203 ), ( 700, 400, 174 ), ( 700, 450, 145 ), ( 700, 500, 116 ), ( 700, 550, 87 ), ( 700, 600, 58 ), ( 700, 650, 29 ),

...

}

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)