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

( 50, 0, 19 ),

( 100, 0, 38 ), ( 100, 50, 19 ),

( 150, 0, 57 ), ( 150, 50, 38 ), ( 150, 100, 19 ),

( 200, 0, 76 ), ( 200, 50, 57 ), ( 200, 100, 38 ), ( 200, 150, 19 ),

( 250, 0, 95 ), ( 250, 50, 76 ), ( 250, 100, 57 ), ( 250, 150, 38 ), ( 250, 200, 19 ),

( 300, 0, 114 ), ( 300, 50, 95 ), ( 300, 100, 76 ), ( 300, 150, 57 ), ( 300, 200, 38 ), ( 300, 250, 19 ),

( 350, 0, 133 ), ( 350, 50, 114 ), ( 350, 100, 95 ), ( 350, 150, 76 ), ( 350, 200, 57 ), ( 350, 250, 38 ), ( 350, 300, 19 ),

( 400, 0, 152 ), ( 400, 50, 133 ), ( 400, 100, 114 ), ( 400, 150, 95 ), ( 400, 200, 76 ), ( 400, 250, 57 ), ( 400, 300, 38 ), ( 400, 350, 19 ),

( 450, 0, 171 ), ( 450, 50, 152 ), ( 450, 100, 133 ), ( 450, 150, 114 ), ( 450, 200, 95 ), ( 450, 250, 76 ), ( 450, 300, 57 ), ( 450, 350, 38 ), ( 450, 400, 19 ),

( 500, 0, 190 ), ( 500, 50, 171 ), ( 500, 100, 152 ), ( 500, 150, 133 ), ( 500, 200, 114 ), ( 500, 250, 95 ), ( 500, 300, 76 ), ( 500, 350, 57 ), ( 500, 400, 38 ), ( 500, 450, 19 ),

( 550, 0, 209 ), ( 550, 50, 190 ), ( 550, 100, 171 ), ( 550, 150, 152 ), ( 550, 200, 133 ), ( 550, 250, 114 ), ( 550, 300, 95 ), ( 550, 350, 76 ), ( 550, 400, 57 ), ( 550, 450, 38 ), ( 550, 500, 19 ),

( 600, 0, 228 ), ( 600, 50, 209 ), ( 600, 100, 190 ), ( 600, 150, 171 ), ( 600, 200, 152 ), ( 600, 250, 133 ), ( 600, 300, 114 ), ( 600, 350, 95 ), ( 600, 400, 76 ), ( 600, 450, 57 ), ( 600, 500, 38 ), ( 600, 550, 19 ),

( 650, 0, 247 ), ( 650, 50, 228 ), ( 650, 100, 209 ), ( 650, 150, 190 ), ( 650, 200, 171 ), ( 650, 250, 152 ), ( 650, 300, 133 ), ( 650, 350, 114 ), ( 650, 400, 95 ), ( 650, 450, 76 ), ( 650, 500, 57 ), ( 650, 550, 38 ), ( 650, 600, 19 ),

( 700, 0, 266 ), ( 700, 50, 247 ), ( 700, 100, 228 ), ( 700, 150, 209 ), ( 700, 200, 190 ), ( 700, 250, 171 ), ( 700, 300, 152 ), ( 700, 350, 133 ), ( 700, 400, 114 ), ( 700, 450, 95 ), ( 700, 500, 76 ), ( 700, 550, 57 ), ( 700, 600, 38 ), ( 700, 650, 19 ),

...

}

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)