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

12/1 = (12-0)/1 = {

( 12, 0, 1 ),

( 24, 0, 2 ), ( 24, 12, 1 ),

( 36, 0, 3 ), ( 36, 12, 2 ), ( 36, 24, 1 ),

( 48, 0, 4 ), ( 48, 12, 3 ), ( 48, 24, 2 ), ( 48, 36, 1 ),

( 60, 0, 5 ), ( 60, 12, 4 ), ( 60, 24, 3 ), ( 60, 36, 2 ), ( 60, 48, 1 ),

( 72, 0, 6 ), ( 72, 12, 5 ), ( 72, 24, 4 ), ( 72, 36, 3 ), ( 72, 48, 2 ), ( 72, 60, 1 ),

( 84, 0, 7 ), ( 84, 12, 6 ), ( 84, 24, 5 ), ( 84, 36, 4 ), ( 84, 48, 3 ), ( 84, 60, 2 ), ( 84, 72, 1 ),

( 96, 0, 8 ), ( 96, 12, 7 ), ( 96, 24, 6 ), ( 96, 36, 5 ), ( 96, 48, 4 ), ( 96, 60, 3 ), ( 96, 72, 2 ), ( 96, 84, 1 ),

( 108, 0, 9 ), ( 108, 12, 8 ), ( 108, 24, 7 ), ( 108, 36, 6 ), ( 108, 48, 5 ), ( 108, 60, 4 ), ( 108, 72, 3 ), ( 108, 84, 2 ), ( 108, 96, 1 ),

( 120, 0, 10 ), ( 120, 12, 9 ), ( 120, 24, 8 ), ( 120, 36, 7 ), ( 120, 48, 6 ), ( 120, 60, 5 ), ( 120, 72, 4 ), ( 120, 84, 3 ), ( 120, 96, 2 ), ( 120, 108, 1 ),

( 132, 0, 11 ), ( 132, 12, 10 ), ( 132, 24, 9 ), ( 132, 36, 8 ), ( 132, 48, 7 ), ( 132, 60, 6 ), ( 132, 72, 5 ), ( 132, 84, 4 ), ( 132, 96, 3 ), ( 132, 108, 2 ), ( 132, 120, 1 ),

( 144, 0, 12 ), ( 144, 12, 11 ), ( 144, 24, 10 ), ( 144, 36, 9 ), ( 144, 48, 8 ), ( 144, 60, 7 ), ( 144, 72, 6 ), ( 144, 84, 5 ), ( 144, 96, 4 ), ( 144, 108, 3 ), ( 144, 120, 2 ), ( 144, 132, 1 ),

( 156, 0, 13 ), ( 156, 12, 12 ), ( 156, 24, 11 ), ( 156, 36, 10 ), ( 156, 48, 9 ), ( 156, 60, 8 ), ( 156, 72, 7 ), ( 156, 84, 6 ), ( 156, 96, 5 ), ( 156, 108, 4 ), ( 156, 120, 3 ), ( 156, 132, 2 ), ( 156, 144, 1 ),

( 168, 0, 14 ), ( 168, 12, 13 ), ( 168, 24, 12 ), ( 168, 36, 11 ), ( 168, 48, 10 ), ( 168, 60, 9 ), ( 168, 72, 8 ), ( 168, 84, 7 ), ( 168, 96, 6 ), ( 168, 108, 5 ), ( 168, 120, 4 ), ( 168, 132, 3 ), ( 168, 144, 2 ), ( 168, 156, 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)