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

( 50, 0, 13 ),

( 100, 0, 26 ), ( 100, 50, 13 ),

( 150, 0, 39 ), ( 150, 50, 26 ), ( 150, 100, 13 ),

( 200, 0, 52 ), ( 200, 50, 39 ), ( 200, 100, 26 ), ( 200, 150, 13 ),

( 250, 0, 65 ), ( 250, 50, 52 ), ( 250, 100, 39 ), ( 250, 150, 26 ), ( 250, 200, 13 ),

( 300, 0, 78 ), ( 300, 50, 65 ), ( 300, 100, 52 ), ( 300, 150, 39 ), ( 300, 200, 26 ), ( 300, 250, 13 ),

( 350, 0, 91 ), ( 350, 50, 78 ), ( 350, 100, 65 ), ( 350, 150, 52 ), ( 350, 200, 39 ), ( 350, 250, 26 ), ( 350, 300, 13 ),

( 400, 0, 104 ), ( 400, 50, 91 ), ( 400, 100, 78 ), ( 400, 150, 65 ), ( 400, 200, 52 ), ( 400, 250, 39 ), ( 400, 300, 26 ), ( 400, 350, 13 ),

( 450, 0, 117 ), ( 450, 50, 104 ), ( 450, 100, 91 ), ( 450, 150, 78 ), ( 450, 200, 65 ), ( 450, 250, 52 ), ( 450, 300, 39 ), ( 450, 350, 26 ), ( 450, 400, 13 ),

( 500, 0, 130 ), ( 500, 50, 117 ), ( 500, 100, 104 ), ( 500, 150, 91 ), ( 500, 200, 78 ), ( 500, 250, 65 ), ( 500, 300, 52 ), ( 500, 350, 39 ), ( 500, 400, 26 ), ( 500, 450, 13 ),

( 550, 0, 143 ), ( 550, 50, 130 ), ( 550, 100, 117 ), ( 550, 150, 104 ), ( 550, 200, 91 ), ( 550, 250, 78 ), ( 550, 300, 65 ), ( 550, 350, 52 ), ( 550, 400, 39 ), ( 550, 450, 26 ), ( 550, 500, 13 ),

( 600, 0, 156 ), ( 600, 50, 143 ), ( 600, 100, 130 ), ( 600, 150, 117 ), ( 600, 200, 104 ), ( 600, 250, 91 ), ( 600, 300, 78 ), ( 600, 350, 65 ), ( 600, 400, 52 ), ( 600, 450, 39 ), ( 600, 500, 26 ), ( 600, 550, 13 ),

( 650, 0, 169 ), ( 650, 50, 156 ), ( 650, 100, 143 ), ( 650, 150, 130 ), ( 650, 200, 117 ), ( 650, 250, 104 ), ( 650, 300, 91 ), ( 650, 350, 78 ), ( 650, 400, 65 ), ( 650, 450, 52 ), ( 650, 500, 39 ), ( 650, 550, 26 ), ( 650, 600, 13 ),

( 700, 0, 182 ), ( 700, 50, 169 ), ( 700, 100, 156 ), ( 700, 150, 143 ), ( 700, 200, 130 ), ( 700, 250, 117 ), ( 700, 300, 104 ), ( 700, 350, 91 ), ( 700, 400, 78 ), ( 700, 450, 65 ), ( 700, 500, 52 ), ( 700, 550, 39 ), ( 700, 600, 26 ), ( 700, 650, 13 ),

...

}

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)