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

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

( 10, 0, 7 ),

( 20, 0, 14 ), ( 20, 10, 7 ),

( 30, 0, 21 ), ( 30, 10, 14 ), ( 30, 20, 7 ),

( 40, 0, 28 ), ( 40, 10, 21 ), ( 40, 20, 14 ), ( 40, 30, 7 ),

( 50, 0, 35 ), ( 50, 10, 28 ), ( 50, 20, 21 ), ( 50, 30, 14 ), ( 50, 40, 7 ),

( 60, 0, 42 ), ( 60, 10, 35 ), ( 60, 20, 28 ), ( 60, 30, 21 ), ( 60, 40, 14 ), ( 60, 50, 7 ),

( 70, 0, 49 ), ( 70, 10, 42 ), ( 70, 20, 35 ), ( 70, 30, 28 ), ( 70, 40, 21 ), ( 70, 50, 14 ), ( 70, 60, 7 ),

( 80, 0, 56 ), ( 80, 10, 49 ), ( 80, 20, 42 ), ( 80, 30, 35 ), ( 80, 40, 28 ), ( 80, 50, 21 ), ( 80, 60, 14 ), ( 80, 70, 7 ),

( 90, 0, 63 ), ( 90, 10, 56 ), ( 90, 20, 49 ), ( 90, 30, 42 ), ( 90, 40, 35 ), ( 90, 50, 28 ), ( 90, 60, 21 ), ( 90, 70, 14 ), ( 90, 80, 7 ),

( 100, 0, 70 ), ( 100, 10, 63 ), ( 100, 20, 56 ), ( 100, 30, 49 ), ( 100, 40, 42 ), ( 100, 50, 35 ), ( 100, 60, 28 ), ( 100, 70, 21 ), ( 100, 80, 14 ), ( 100, 90, 7 ),

( 110, 0, 77 ), ( 110, 10, 70 ), ( 110, 20, 63 ), ( 110, 30, 56 ), ( 110, 40, 49 ), ( 110, 50, 42 ), ( 110, 60, 35 ), ( 110, 70, 28 ), ( 110, 80, 21 ), ( 110, 90, 14 ), ( 110, 100, 7 ),

( 120, 0, 84 ), ( 120, 10, 77 ), ( 120, 20, 70 ), ( 120, 30, 63 ), ( 120, 40, 56 ), ( 120, 50, 49 ), ( 120, 60, 42 ), ( 120, 70, 35 ), ( 120, 80, 28 ), ( 120, 90, 21 ), ( 120, 100, 14 ), ( 120, 110, 7 ),

( 130, 0, 91 ), ( 130, 10, 84 ), ( 130, 20, 77 ), ( 130, 30, 70 ), ( 130, 40, 63 ), ( 130, 50, 56 ), ( 130, 60, 49 ), ( 130, 70, 42 ), ( 130, 80, 35 ), ( 130, 90, 28 ), ( 130, 100, 21 ), ( 130, 110, 14 ), ( 130, 120, 7 ),

( 140, 0, 98 ), ( 140, 10, 91 ), ( 140, 20, 84 ), ( 140, 30, 77 ), ( 140, 40, 70 ), ( 140, 50, 63 ), ( 140, 60, 56 ), ( 140, 70, 49 ), ( 140, 80, 42 ), ( 140, 90, 35 ), ( 140, 100, 28 ), ( 140, 110, 21 ), ( 140, 120, 14 ), ( 140, 130, 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)