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

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

( 30, 0, 11 ),

( 60, 0, 22 ), ( 60, 30, 11 ),

( 90, 0, 33 ), ( 90, 30, 22 ), ( 90, 60, 11 ),

( 120, 0, 44 ), ( 120, 30, 33 ), ( 120, 60, 22 ), ( 120, 90, 11 ),

( 150, 0, 55 ), ( 150, 30, 44 ), ( 150, 60, 33 ), ( 150, 90, 22 ), ( 150, 120, 11 ),

( 180, 0, 66 ), ( 180, 30, 55 ), ( 180, 60, 44 ), ( 180, 90, 33 ), ( 180, 120, 22 ), ( 180, 150, 11 ),

( 210, 0, 77 ), ( 210, 30, 66 ), ( 210, 60, 55 ), ( 210, 90, 44 ), ( 210, 120, 33 ), ( 210, 150, 22 ), ( 210, 180, 11 ),

( 240, 0, 88 ), ( 240, 30, 77 ), ( 240, 60, 66 ), ( 240, 90, 55 ), ( 240, 120, 44 ), ( 240, 150, 33 ), ( 240, 180, 22 ), ( 240, 210, 11 ),

( 270, 0, 99 ), ( 270, 30, 88 ), ( 270, 60, 77 ), ( 270, 90, 66 ), ( 270, 120, 55 ), ( 270, 150, 44 ), ( 270, 180, 33 ), ( 270, 210, 22 ), ( 270, 240, 11 ),

( 300, 0, 110 ), ( 300, 30, 99 ), ( 300, 60, 88 ), ( 300, 90, 77 ), ( 300, 120, 66 ), ( 300, 150, 55 ), ( 300, 180, 44 ), ( 300, 210, 33 ), ( 300, 240, 22 ), ( 300, 270, 11 ),

( 330, 0, 121 ), ( 330, 30, 110 ), ( 330, 60, 99 ), ( 330, 90, 88 ), ( 330, 120, 77 ), ( 330, 150, 66 ), ( 330, 180, 55 ), ( 330, 210, 44 ), ( 330, 240, 33 ), ( 330, 270, 22 ), ( 330, 300, 11 ),

( 360, 0, 132 ), ( 360, 30, 121 ), ( 360, 60, 110 ), ( 360, 90, 99 ), ( 360, 120, 88 ), ( 360, 150, 77 ), ( 360, 180, 66 ), ( 360, 210, 55 ), ( 360, 240, 44 ), ( 360, 270, 33 ), ( 360, 300, 22 ), ( 360, 330, 11 ),

( 390, 0, 143 ), ( 390, 30, 132 ), ( 390, 60, 121 ), ( 390, 90, 110 ), ( 390, 120, 99 ), ( 390, 150, 88 ), ( 390, 180, 77 ), ( 390, 210, 66 ), ( 390, 240, 55 ), ( 390, 270, 44 ), ( 390, 300, 33 ), ( 390, 330, 22 ), ( 390, 360, 11 ),

( 420, 0, 154 ), ( 420, 30, 143 ), ( 420, 60, 132 ), ( 420, 90, 121 ), ( 420, 120, 110 ), ( 420, 150, 99 ), ( 420, 180, 88 ), ( 420, 210, 77 ), ( 420, 240, 66 ), ( 420, 270, 55 ), ( 420, 300, 44 ), ( 420, 330, 33 ), ( 420, 360, 22 ), ( 420, 390, 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)