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

( 14, 0, 1 ),

( 28, 0, 2 ), ( 28, 14, 1 ),

( 42, 0, 3 ), ( 42, 14, 2 ), ( 42, 28, 1 ),

( 56, 0, 4 ), ( 56, 14, 3 ), ( 56, 28, 2 ), ( 56, 42, 1 ),

( 70, 0, 5 ), ( 70, 14, 4 ), ( 70, 28, 3 ), ( 70, 42, 2 ), ( 70, 56, 1 ),

( 84, 0, 6 ), ( 84, 14, 5 ), ( 84, 28, 4 ), ( 84, 42, 3 ), ( 84, 56, 2 ), ( 84, 70, 1 ),

( 98, 0, 7 ), ( 98, 14, 6 ), ( 98, 28, 5 ), ( 98, 42, 4 ), ( 98, 56, 3 ), ( 98, 70, 2 ), ( 98, 84, 1 ),

( 112, 0, 8 ), ( 112, 14, 7 ), ( 112, 28, 6 ), ( 112, 42, 5 ), ( 112, 56, 4 ), ( 112, 70, 3 ), ( 112, 84, 2 ), ( 112, 98, 1 ),

( 126, 0, 9 ), ( 126, 14, 8 ), ( 126, 28, 7 ), ( 126, 42, 6 ), ( 126, 56, 5 ), ( 126, 70, 4 ), ( 126, 84, 3 ), ( 126, 98, 2 ), ( 126, 112, 1 ),

( 140, 0, 10 ), ( 140, 14, 9 ), ( 140, 28, 8 ), ( 140, 42, 7 ), ( 140, 56, 6 ), ( 140, 70, 5 ), ( 140, 84, 4 ), ( 140, 98, 3 ), ( 140, 112, 2 ), ( 140, 126, 1 ),

( 154, 0, 11 ), ( 154, 14, 10 ), ( 154, 28, 9 ), ( 154, 42, 8 ), ( 154, 56, 7 ), ( 154, 70, 6 ), ( 154, 84, 5 ), ( 154, 98, 4 ), ( 154, 112, 3 ), ( 154, 126, 2 ), ( 154, 140, 1 ),

( 168, 0, 12 ), ( 168, 14, 11 ), ( 168, 28, 10 ), ( 168, 42, 9 ), ( 168, 56, 8 ), ( 168, 70, 7 ), ( 168, 84, 6 ), ( 168, 98, 5 ), ( 168, 112, 4 ), ( 168, 126, 3 ), ( 168, 140, 2 ), ( 168, 154, 1 ),

( 182, 0, 13 ), ( 182, 14, 12 ), ( 182, 28, 11 ), ( 182, 42, 10 ), ( 182, 56, 9 ), ( 182, 70, 8 ), ( 182, 84, 7 ), ( 182, 98, 6 ), ( 182, 112, 5 ), ( 182, 126, 4 ), ( 182, 140, 3 ), ( 182, 154, 2 ), ( 182, 168, 1 ),

( 196, 0, 14 ), ( 196, 14, 13 ), ( 196, 28, 12 ), ( 196, 42, 11 ), ( 196, 56, 10 ), ( 196, 70, 9 ), ( 196, 84, 8 ), ( 196, 98, 7 ), ( 196, 112, 6 ), ( 196, 126, 5 ), ( 196, 140, 4 ), ( 196, 154, 3 ), ( 196, 168, 2 ), ( 196, 182, 1 ),

...

}

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)