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

( 26, 0, 5 ),

( 52, 0, 10 ), ( 52, 26, 5 ),

( 78, 0, 15 ), ( 78, 26, 10 ), ( 78, 52, 5 ),

( 104, 0, 20 ), ( 104, 26, 15 ), ( 104, 52, 10 ), ( 104, 78, 5 ),

( 130, 0, 25 ), ( 130, 26, 20 ), ( 130, 52, 15 ), ( 130, 78, 10 ), ( 130, 104, 5 ),

( 156, 0, 30 ), ( 156, 26, 25 ), ( 156, 52, 20 ), ( 156, 78, 15 ), ( 156, 104, 10 ), ( 156, 130, 5 ),

( 182, 0, 35 ), ( 182, 26, 30 ), ( 182, 52, 25 ), ( 182, 78, 20 ), ( 182, 104, 15 ), ( 182, 130, 10 ), ( 182, 156, 5 ),

( 208, 0, 40 ), ( 208, 26, 35 ), ( 208, 52, 30 ), ( 208, 78, 25 ), ( 208, 104, 20 ), ( 208, 130, 15 ), ( 208, 156, 10 ), ( 208, 182, 5 ),

( 234, 0, 45 ), ( 234, 26, 40 ), ( 234, 52, 35 ), ( 234, 78, 30 ), ( 234, 104, 25 ), ( 234, 130, 20 ), ( 234, 156, 15 ), ( 234, 182, 10 ), ( 234, 208, 5 ),

( 260, 0, 50 ), ( 260, 26, 45 ), ( 260, 52, 40 ), ( 260, 78, 35 ), ( 260, 104, 30 ), ( 260, 130, 25 ), ( 260, 156, 20 ), ( 260, 182, 15 ), ( 260, 208, 10 ), ( 260, 234, 5 ),

( 286, 0, 55 ), ( 286, 26, 50 ), ( 286, 52, 45 ), ( 286, 78, 40 ), ( 286, 104, 35 ), ( 286, 130, 30 ), ( 286, 156, 25 ), ( 286, 182, 20 ), ( 286, 208, 15 ), ( 286, 234, 10 ), ( 286, 260, 5 ),

( 312, 0, 60 ), ( 312, 26, 55 ), ( 312, 52, 50 ), ( 312, 78, 45 ), ( 312, 104, 40 ), ( 312, 130, 35 ), ( 312, 156, 30 ), ( 312, 182, 25 ), ( 312, 208, 20 ), ( 312, 234, 15 ), ( 312, 260, 10 ), ( 312, 286, 5 ),

( 338, 0, 65 ), ( 338, 26, 60 ), ( 338, 52, 55 ), ( 338, 78, 50 ), ( 338, 104, 45 ), ( 338, 130, 40 ), ( 338, 156, 35 ), ( 338, 182, 30 ), ( 338, 208, 25 ), ( 338, 234, 20 ), ( 338, 260, 15 ), ( 338, 286, 10 ), ( 338, 312, 5 ),

( 364, 0, 70 ), ( 364, 26, 65 ), ( 364, 52, 60 ), ( 364, 78, 55 ), ( 364, 104, 50 ), ( 364, 130, 45 ), ( 364, 156, 40 ), ( 364, 182, 35 ), ( 364, 208, 30 ), ( 364, 234, 25 ), ( 364, 260, 20 ), ( 364, 286, 15 ), ( 364, 312, 10 ), ( 364, 338, 5 ),

...

}

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)