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

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

( 21, 0, 11 ),

( 42, 0, 22 ), ( 42, 21, 11 ),

( 63, 0, 33 ), ( 63, 21, 22 ), ( 63, 42, 11 ),

( 84, 0, 44 ), ( 84, 21, 33 ), ( 84, 42, 22 ), ( 84, 63, 11 ),

( 105, 0, 55 ), ( 105, 21, 44 ), ( 105, 42, 33 ), ( 105, 63, 22 ), ( 105, 84, 11 ),

( 126, 0, 66 ), ( 126, 21, 55 ), ( 126, 42, 44 ), ( 126, 63, 33 ), ( 126, 84, 22 ), ( 126, 105, 11 ),

( 147, 0, 77 ), ( 147, 21, 66 ), ( 147, 42, 55 ), ( 147, 63, 44 ), ( 147, 84, 33 ), ( 147, 105, 22 ), ( 147, 126, 11 ),

( 168, 0, 88 ), ( 168, 21, 77 ), ( 168, 42, 66 ), ( 168, 63, 55 ), ( 168, 84, 44 ), ( 168, 105, 33 ), ( 168, 126, 22 ), ( 168, 147, 11 ),

( 189, 0, 99 ), ( 189, 21, 88 ), ( 189, 42, 77 ), ( 189, 63, 66 ), ( 189, 84, 55 ), ( 189, 105, 44 ), ( 189, 126, 33 ), ( 189, 147, 22 ), ( 189, 168, 11 ),

( 210, 0, 110 ), ( 210, 21, 99 ), ( 210, 42, 88 ), ( 210, 63, 77 ), ( 210, 84, 66 ), ( 210, 105, 55 ), ( 210, 126, 44 ), ( 210, 147, 33 ), ( 210, 168, 22 ), ( 210, 189, 11 ),

( 231, 0, 121 ), ( 231, 21, 110 ), ( 231, 42, 99 ), ( 231, 63, 88 ), ( 231, 84, 77 ), ( 231, 105, 66 ), ( 231, 126, 55 ), ( 231, 147, 44 ), ( 231, 168, 33 ), ( 231, 189, 22 ), ( 231, 210, 11 ),

( 252, 0, 132 ), ( 252, 21, 121 ), ( 252, 42, 110 ), ( 252, 63, 99 ), ( 252, 84, 88 ), ( 252, 105, 77 ), ( 252, 126, 66 ), ( 252, 147, 55 ), ( 252, 168, 44 ), ( 252, 189, 33 ), ( 252, 210, 22 ), ( 252, 231, 11 ),

( 273, 0, 143 ), ( 273, 21, 132 ), ( 273, 42, 121 ), ( 273, 63, 110 ), ( 273, 84, 99 ), ( 273, 105, 88 ), ( 273, 126, 77 ), ( 273, 147, 66 ), ( 273, 168, 55 ), ( 273, 189, 44 ), ( 273, 210, 33 ), ( 273, 231, 22 ), ( 273, 252, 11 ),

( 294, 0, 154 ), ( 294, 21, 143 ), ( 294, 42, 132 ), ( 294, 63, 121 ), ( 294, 84, 110 ), ( 294, 105, 99 ), ( 294, 126, 88 ), ( 294, 147, 77 ), ( 294, 168, 66 ), ( 294, 189, 55 ), ( 294, 210, 44 ), ( 294, 231, 33 ), ( 294, 252, 22 ), ( 294, 273, 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)