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

( 26, 0, 7 ),

( 52, 0, 14 ), ( 52, 26, 7 ),

( 78, 0, 21 ), ( 78, 26, 14 ), ( 78, 52, 7 ),

( 104, 0, 28 ), ( 104, 26, 21 ), ( 104, 52, 14 ), ( 104, 78, 7 ),

( 130, 0, 35 ), ( 130, 26, 28 ), ( 130, 52, 21 ), ( 130, 78, 14 ), ( 130, 104, 7 ),

( 156, 0, 42 ), ( 156, 26, 35 ), ( 156, 52, 28 ), ( 156, 78, 21 ), ( 156, 104, 14 ), ( 156, 130, 7 ),

( 182, 0, 49 ), ( 182, 26, 42 ), ( 182, 52, 35 ), ( 182, 78, 28 ), ( 182, 104, 21 ), ( 182, 130, 14 ), ( 182, 156, 7 ),

( 208, 0, 56 ), ( 208, 26, 49 ), ( 208, 52, 42 ), ( 208, 78, 35 ), ( 208, 104, 28 ), ( 208, 130, 21 ), ( 208, 156, 14 ), ( 208, 182, 7 ),

( 234, 0, 63 ), ( 234, 26, 56 ), ( 234, 52, 49 ), ( 234, 78, 42 ), ( 234, 104, 35 ), ( 234, 130, 28 ), ( 234, 156, 21 ), ( 234, 182, 14 ), ( 234, 208, 7 ),

( 260, 0, 70 ), ( 260, 26, 63 ), ( 260, 52, 56 ), ( 260, 78, 49 ), ( 260, 104, 42 ), ( 260, 130, 35 ), ( 260, 156, 28 ), ( 260, 182, 21 ), ( 260, 208, 14 ), ( 260, 234, 7 ),

( 286, 0, 77 ), ( 286, 26, 70 ), ( 286, 52, 63 ), ( 286, 78, 56 ), ( 286, 104, 49 ), ( 286, 130, 42 ), ( 286, 156, 35 ), ( 286, 182, 28 ), ( 286, 208, 21 ), ( 286, 234, 14 ), ( 286, 260, 7 ),

( 312, 0, 84 ), ( 312, 26, 77 ), ( 312, 52, 70 ), ( 312, 78, 63 ), ( 312, 104, 56 ), ( 312, 130, 49 ), ( 312, 156, 42 ), ( 312, 182, 35 ), ( 312, 208, 28 ), ( 312, 234, 21 ), ( 312, 260, 14 ), ( 312, 286, 7 ),

( 338, 0, 91 ), ( 338, 26, 84 ), ( 338, 52, 77 ), ( 338, 78, 70 ), ( 338, 104, 63 ), ( 338, 130, 56 ), ( 338, 156, 49 ), ( 338, 182, 42 ), ( 338, 208, 35 ), ( 338, 234, 28 ), ( 338, 260, 21 ), ( 338, 286, 14 ), ( 338, 312, 7 ),

( 364, 0, 98 ), ( 364, 26, 91 ), ( 364, 52, 84 ), ( 364, 78, 77 ), ( 364, 104, 70 ), ( 364, 130, 63 ), ( 364, 156, 56 ), ( 364, 182, 49 ), ( 364, 208, 42 ), ( 364, 234, 35 ), ( 364, 260, 28 ), ( 364, 286, 21 ), ( 364, 312, 14 ), ( 364, 338, 7 ),

...

}

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)