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

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

( 14, 0, 3 ),

( 28, 0, 6 ), ( 28, 14, 3 ),

( 42, 0, 9 ), ( 42, 14, 6 ), ( 42, 28, 3 ),

( 56, 0, 12 ), ( 56, 14, 9 ), ( 56, 28, 6 ), ( 56, 42, 3 ),

( 70, 0, 15 ), ( 70, 14, 12 ), ( 70, 28, 9 ), ( 70, 42, 6 ), ( 70, 56, 3 ),

( 84, 0, 18 ), ( 84, 14, 15 ), ( 84, 28, 12 ), ( 84, 42, 9 ), ( 84, 56, 6 ), ( 84, 70, 3 ),

( 98, 0, 21 ), ( 98, 14, 18 ), ( 98, 28, 15 ), ( 98, 42, 12 ), ( 98, 56, 9 ), ( 98, 70, 6 ), ( 98, 84, 3 ),

( 112, 0, 24 ), ( 112, 14, 21 ), ( 112, 28, 18 ), ( 112, 42, 15 ), ( 112, 56, 12 ), ( 112, 70, 9 ), ( 112, 84, 6 ), ( 112, 98, 3 ),

( 126, 0, 27 ), ( 126, 14, 24 ), ( 126, 28, 21 ), ( 126, 42, 18 ), ( 126, 56, 15 ), ( 126, 70, 12 ), ( 126, 84, 9 ), ( 126, 98, 6 ), ( 126, 112, 3 ),

( 140, 0, 30 ), ( 140, 14, 27 ), ( 140, 28, 24 ), ( 140, 42, 21 ), ( 140, 56, 18 ), ( 140, 70, 15 ), ( 140, 84, 12 ), ( 140, 98, 9 ), ( 140, 112, 6 ), ( 140, 126, 3 ),

( 154, 0, 33 ), ( 154, 14, 30 ), ( 154, 28, 27 ), ( 154, 42, 24 ), ( 154, 56, 21 ), ( 154, 70, 18 ), ( 154, 84, 15 ), ( 154, 98, 12 ), ( 154, 112, 9 ), ( 154, 126, 6 ), ( 154, 140, 3 ),

( 168, 0, 36 ), ( 168, 14, 33 ), ( 168, 28, 30 ), ( 168, 42, 27 ), ( 168, 56, 24 ), ( 168, 70, 21 ), ( 168, 84, 18 ), ( 168, 98, 15 ), ( 168, 112, 12 ), ( 168, 126, 9 ), ( 168, 140, 6 ), ( 168, 154, 3 ),

( 182, 0, 39 ), ( 182, 14, 36 ), ( 182, 28, 33 ), ( 182, 42, 30 ), ( 182, 56, 27 ), ( 182, 70, 24 ), ( 182, 84, 21 ), ( 182, 98, 18 ), ( 182, 112, 15 ), ( 182, 126, 12 ), ( 182, 140, 9 ), ( 182, 154, 6 ), ( 182, 168, 3 ),

( 196, 0, 42 ), ( 196, 14, 39 ), ( 196, 28, 36 ), ( 196, 42, 33 ), ( 196, 56, 30 ), ( 196, 70, 27 ), ( 196, 84, 24 ), ( 196, 98, 21 ), ( 196, 112, 18 ), ( 196, 126, 15 ), ( 196, 140, 12 ), ( 196, 154, 9 ), ( 196, 168, 6 ), ( 196, 182, 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)