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

40/11 = (40-0)/11 = {

( 40, 0, 11 ),

( 80, 0, 22 ), ( 80, 40, 11 ),

( 120, 0, 33 ), ( 120, 40, 22 ), ( 120, 80, 11 ),

( 160, 0, 44 ), ( 160, 40, 33 ), ( 160, 80, 22 ), ( 160, 120, 11 ),

( 200, 0, 55 ), ( 200, 40, 44 ), ( 200, 80, 33 ), ( 200, 120, 22 ), ( 200, 160, 11 ),

( 240, 0, 66 ), ( 240, 40, 55 ), ( 240, 80, 44 ), ( 240, 120, 33 ), ( 240, 160, 22 ), ( 240, 200, 11 ),

( 280, 0, 77 ), ( 280, 40, 66 ), ( 280, 80, 55 ), ( 280, 120, 44 ), ( 280, 160, 33 ), ( 280, 200, 22 ), ( 280, 240, 11 ),

( 320, 0, 88 ), ( 320, 40, 77 ), ( 320, 80, 66 ), ( 320, 120, 55 ), ( 320, 160, 44 ), ( 320, 200, 33 ), ( 320, 240, 22 ), ( 320, 280, 11 ),

( 360, 0, 99 ), ( 360, 40, 88 ), ( 360, 80, 77 ), ( 360, 120, 66 ), ( 360, 160, 55 ), ( 360, 200, 44 ), ( 360, 240, 33 ), ( 360, 280, 22 ), ( 360, 320, 11 ),

( 400, 0, 110 ), ( 400, 40, 99 ), ( 400, 80, 88 ), ( 400, 120, 77 ), ( 400, 160, 66 ), ( 400, 200, 55 ), ( 400, 240, 44 ), ( 400, 280, 33 ), ( 400, 320, 22 ), ( 400, 360, 11 ),

( 440, 0, 121 ), ( 440, 40, 110 ), ( 440, 80, 99 ), ( 440, 120, 88 ), ( 440, 160, 77 ), ( 440, 200, 66 ), ( 440, 240, 55 ), ( 440, 280, 44 ), ( 440, 320, 33 ), ( 440, 360, 22 ), ( 440, 400, 11 ),

( 480, 0, 132 ), ( 480, 40, 121 ), ( 480, 80, 110 ), ( 480, 120, 99 ), ( 480, 160, 88 ), ( 480, 200, 77 ), ( 480, 240, 66 ), ( 480, 280, 55 ), ( 480, 320, 44 ), ( 480, 360, 33 ), ( 480, 400, 22 ), ( 480, 440, 11 ),

( 520, 0, 143 ), ( 520, 40, 132 ), ( 520, 80, 121 ), ( 520, 120, 110 ), ( 520, 160, 99 ), ( 520, 200, 88 ), ( 520, 240, 77 ), ( 520, 280, 66 ), ( 520, 320, 55 ), ( 520, 360, 44 ), ( 520, 400, 33 ), ( 520, 440, 22 ), ( 520, 480, 11 ),

( 560, 0, 154 ), ( 560, 40, 143 ), ( 560, 80, 132 ), ( 560, 120, 121 ), ( 560, 160, 110 ), ( 560, 200, 99 ), ( 560, 240, 88 ), ( 560, 280, 77 ), ( 560, 320, 66 ), ( 560, 360, 55 ), ( 560, 400, 44 ), ( 560, 440, 33 ), ( 560, 480, 22 ), ( 560, 520, 11 ),

...

}

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)