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

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

( 45, 0, 1 ),

( 90, 0, 2 ), ( 90, 45, 1 ),

( 135, 0, 3 ), ( 135, 45, 2 ), ( 135, 90, 1 ),

( 180, 0, 4 ), ( 180, 45, 3 ), ( 180, 90, 2 ), ( 180, 135, 1 ),

( 225, 0, 5 ), ( 225, 45, 4 ), ( 225, 90, 3 ), ( 225, 135, 2 ), ( 225, 180, 1 ),

( 270, 0, 6 ), ( 270, 45, 5 ), ( 270, 90, 4 ), ( 270, 135, 3 ), ( 270, 180, 2 ), ( 270, 225, 1 ),

( 315, 0, 7 ), ( 315, 45, 6 ), ( 315, 90, 5 ), ( 315, 135, 4 ), ( 315, 180, 3 ), ( 315, 225, 2 ), ( 315, 270, 1 ),

( 360, 0, 8 ), ( 360, 45, 7 ), ( 360, 90, 6 ), ( 360, 135, 5 ), ( 360, 180, 4 ), ( 360, 225, 3 ), ( 360, 270, 2 ), ( 360, 315, 1 ),

( 405, 0, 9 ), ( 405, 45, 8 ), ( 405, 90, 7 ), ( 405, 135, 6 ), ( 405, 180, 5 ), ( 405, 225, 4 ), ( 405, 270, 3 ), ( 405, 315, 2 ), ( 405, 360, 1 ),

( 450, 0, 10 ), ( 450, 45, 9 ), ( 450, 90, 8 ), ( 450, 135, 7 ), ( 450, 180, 6 ), ( 450, 225, 5 ), ( 450, 270, 4 ), ( 450, 315, 3 ), ( 450, 360, 2 ), ( 450, 405, 1 ),

( 495, 0, 11 ), ( 495, 45, 10 ), ( 495, 90, 9 ), ( 495, 135, 8 ), ( 495, 180, 7 ), ( 495, 225, 6 ), ( 495, 270, 5 ), ( 495, 315, 4 ), ( 495, 360, 3 ), ( 495, 405, 2 ), ( 495, 450, 1 ),

( 540, 0, 12 ), ( 540, 45, 11 ), ( 540, 90, 10 ), ( 540, 135, 9 ), ( 540, 180, 8 ), ( 540, 225, 7 ), ( 540, 270, 6 ), ( 540, 315, 5 ), ( 540, 360, 4 ), ( 540, 405, 3 ), ( 540, 450, 2 ), ( 540, 495, 1 ),

( 585, 0, 13 ), ( 585, 45, 12 ), ( 585, 90, 11 ), ( 585, 135, 10 ), ( 585, 180, 9 ), ( 585, 225, 8 ), ( 585, 270, 7 ), ( 585, 315, 6 ), ( 585, 360, 5 ), ( 585, 405, 4 ), ( 585, 450, 3 ), ( 585, 495, 2 ), ( 585, 540, 1 ),

( 630, 0, 14 ), ( 630, 45, 13 ), ( 630, 90, 12 ), ( 630, 135, 11 ), ( 630, 180, 10 ), ( 630, 225, 9 ), ( 630, 270, 8 ), ( 630, 315, 7 ), ( 630, 360, 6 ), ( 630, 405, 5 ), ( 630, 450, 4 ), ( 630, 495, 3 ), ( 630, 540, 2 ), ( 630, 585, 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)