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

13/7 = (13-0)/7 = {

( 13, 0, 7 ),

( 26, 0, 14 ), ( 26, 13, 7 ),

( 39, 0, 21 ), ( 39, 13, 14 ), ( 39, 26, 7 ),

( 52, 0, 28 ), ( 52, 13, 21 ), ( 52, 26, 14 ), ( 52, 39, 7 ),

( 65, 0, 35 ), ( 65, 13, 28 ), ( 65, 26, 21 ), ( 65, 39, 14 ), ( 65, 52, 7 ),

( 78, 0, 42 ), ( 78, 13, 35 ), ( 78, 26, 28 ), ( 78, 39, 21 ), ( 78, 52, 14 ), ( 78, 65, 7 ),

( 91, 0, 49 ), ( 91, 13, 42 ), ( 91, 26, 35 ), ( 91, 39, 28 ), ( 91, 52, 21 ), ( 91, 65, 14 ), ( 91, 78, 7 ),

( 104, 0, 56 ), ( 104, 13, 49 ), ( 104, 26, 42 ), ( 104, 39, 35 ), ( 104, 52, 28 ), ( 104, 65, 21 ), ( 104, 78, 14 ), ( 104, 91, 7 ),

( 117, 0, 63 ), ( 117, 13, 56 ), ( 117, 26, 49 ), ( 117, 39, 42 ), ( 117, 52, 35 ), ( 117, 65, 28 ), ( 117, 78, 21 ), ( 117, 91, 14 ), ( 117, 104, 7 ),

( 130, 0, 70 ), ( 130, 13, 63 ), ( 130, 26, 56 ), ( 130, 39, 49 ), ( 130, 52, 42 ), ( 130, 65, 35 ), ( 130, 78, 28 ), ( 130, 91, 21 ), ( 130, 104, 14 ), ( 130, 117, 7 ),

( 143, 0, 77 ), ( 143, 13, 70 ), ( 143, 26, 63 ), ( 143, 39, 56 ), ( 143, 52, 49 ), ( 143, 65, 42 ), ( 143, 78, 35 ), ( 143, 91, 28 ), ( 143, 104, 21 ), ( 143, 117, 14 ), ( 143, 130, 7 ),

( 156, 0, 84 ), ( 156, 13, 77 ), ( 156, 26, 70 ), ( 156, 39, 63 ), ( 156, 52, 56 ), ( 156, 65, 49 ), ( 156, 78, 42 ), ( 156, 91, 35 ), ( 156, 104, 28 ), ( 156, 117, 21 ), ( 156, 130, 14 ), ( 156, 143, 7 ),

( 169, 0, 91 ), ( 169, 13, 84 ), ( 169, 26, 77 ), ( 169, 39, 70 ), ( 169, 52, 63 ), ( 169, 65, 56 ), ( 169, 78, 49 ), ( 169, 91, 42 ), ( 169, 104, 35 ), ( 169, 117, 28 ), ( 169, 130, 21 ), ( 169, 143, 14 ), ( 169, 156, 7 ),

( 182, 0, 98 ), ( 182, 13, 91 ), ( 182, 26, 84 ), ( 182, 39, 77 ), ( 182, 52, 70 ), ( 182, 65, 63 ), ( 182, 78, 56 ), ( 182, 91, 49 ), ( 182, 104, 42 ), ( 182, 117, 35 ), ( 182, 130, 28 ), ( 182, 143, 21 ), ( 182, 156, 14 ), ( 182, 169, 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)