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

26/3 = (26-0)/3 = {

( 26, 0, 3 ),

( 52, 0, 6 ), ( 52, 26, 3 ),

( 78, 0, 9 ), ( 78, 26, 6 ), ( 78, 52, 3 ),

( 104, 0, 12 ), ( 104, 26, 9 ), ( 104, 52, 6 ), ( 104, 78, 3 ),

( 130, 0, 15 ), ( 130, 26, 12 ), ( 130, 52, 9 ), ( 130, 78, 6 ), ( 130, 104, 3 ),

( 156, 0, 18 ), ( 156, 26, 15 ), ( 156, 52, 12 ), ( 156, 78, 9 ), ( 156, 104, 6 ), ( 156, 130, 3 ),

( 182, 0, 21 ), ( 182, 26, 18 ), ( 182, 52, 15 ), ( 182, 78, 12 ), ( 182, 104, 9 ), ( 182, 130, 6 ), ( 182, 156, 3 ),

( 208, 0, 24 ), ( 208, 26, 21 ), ( 208, 52, 18 ), ( 208, 78, 15 ), ( 208, 104, 12 ), ( 208, 130, 9 ), ( 208, 156, 6 ), ( 208, 182, 3 ),

( 234, 0, 27 ), ( 234, 26, 24 ), ( 234, 52, 21 ), ( 234, 78, 18 ), ( 234, 104, 15 ), ( 234, 130, 12 ), ( 234, 156, 9 ), ( 234, 182, 6 ), ( 234, 208, 3 ),

( 260, 0, 30 ), ( 260, 26, 27 ), ( 260, 52, 24 ), ( 260, 78, 21 ), ( 260, 104, 18 ), ( 260, 130, 15 ), ( 260, 156, 12 ), ( 260, 182, 9 ), ( 260, 208, 6 ), ( 260, 234, 3 ),

( 286, 0, 33 ), ( 286, 26, 30 ), ( 286, 52, 27 ), ( 286, 78, 24 ), ( 286, 104, 21 ), ( 286, 130, 18 ), ( 286, 156, 15 ), ( 286, 182, 12 ), ( 286, 208, 9 ), ( 286, 234, 6 ), ( 286, 260, 3 ),

( 312, 0, 36 ), ( 312, 26, 33 ), ( 312, 52, 30 ), ( 312, 78, 27 ), ( 312, 104, 24 ), ( 312, 130, 21 ), ( 312, 156, 18 ), ( 312, 182, 15 ), ( 312, 208, 12 ), ( 312, 234, 9 ), ( 312, 260, 6 ), ( 312, 286, 3 ),

( 338, 0, 39 ), ( 338, 26, 36 ), ( 338, 52, 33 ), ( 338, 78, 30 ), ( 338, 104, 27 ), ( 338, 130, 24 ), ( 338, 156, 21 ), ( 338, 182, 18 ), ( 338, 208, 15 ), ( 338, 234, 12 ), ( 338, 260, 9 ), ( 338, 286, 6 ), ( 338, 312, 3 ),

( 364, 0, 42 ), ( 364, 26, 39 ), ( 364, 52, 36 ), ( 364, 78, 33 ), ( 364, 104, 30 ), ( 364, 130, 27 ), ( 364, 156, 24 ), ( 364, 182, 21 ), ( 364, 208, 18 ), ( 364, 234, 15 ), ( 364, 260, 12 ), ( 364, 286, 9 ), ( 364, 312, 6 ), ( 364, 338, 3 ),

...

}

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)