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

( 45, 0, 2 ),

( 90, 0, 4 ), ( 90, 45, 2 ),

( 135, 0, 6 ), ( 135, 45, 4 ), ( 135, 90, 2 ),

( 180, 0, 8 ), ( 180, 45, 6 ), ( 180, 90, 4 ), ( 180, 135, 2 ),

( 225, 0, 10 ), ( 225, 45, 8 ), ( 225, 90, 6 ), ( 225, 135, 4 ), ( 225, 180, 2 ),

( 270, 0, 12 ), ( 270, 45, 10 ), ( 270, 90, 8 ), ( 270, 135, 6 ), ( 270, 180, 4 ), ( 270, 225, 2 ),

( 315, 0, 14 ), ( 315, 45, 12 ), ( 315, 90, 10 ), ( 315, 135, 8 ), ( 315, 180, 6 ), ( 315, 225, 4 ), ( 315, 270, 2 ),

( 360, 0, 16 ), ( 360, 45, 14 ), ( 360, 90, 12 ), ( 360, 135, 10 ), ( 360, 180, 8 ), ( 360, 225, 6 ), ( 360, 270, 4 ), ( 360, 315, 2 ),

( 405, 0, 18 ), ( 405, 45, 16 ), ( 405, 90, 14 ), ( 405, 135, 12 ), ( 405, 180, 10 ), ( 405, 225, 8 ), ( 405, 270, 6 ), ( 405, 315, 4 ), ( 405, 360, 2 ),

( 450, 0, 20 ), ( 450, 45, 18 ), ( 450, 90, 16 ), ( 450, 135, 14 ), ( 450, 180, 12 ), ( 450, 225, 10 ), ( 450, 270, 8 ), ( 450, 315, 6 ), ( 450, 360, 4 ), ( 450, 405, 2 ),

( 495, 0, 22 ), ( 495, 45, 20 ), ( 495, 90, 18 ), ( 495, 135, 16 ), ( 495, 180, 14 ), ( 495, 225, 12 ), ( 495, 270, 10 ), ( 495, 315, 8 ), ( 495, 360, 6 ), ( 495, 405, 4 ), ( 495, 450, 2 ),

( 540, 0, 24 ), ( 540, 45, 22 ), ( 540, 90, 20 ), ( 540, 135, 18 ), ( 540, 180, 16 ), ( 540, 225, 14 ), ( 540, 270, 12 ), ( 540, 315, 10 ), ( 540, 360, 8 ), ( 540, 405, 6 ), ( 540, 450, 4 ), ( 540, 495, 2 ),

( 585, 0, 26 ), ( 585, 45, 24 ), ( 585, 90, 22 ), ( 585, 135, 20 ), ( 585, 180, 18 ), ( 585, 225, 16 ), ( 585, 270, 14 ), ( 585, 315, 12 ), ( 585, 360, 10 ), ( 585, 405, 8 ), ( 585, 450, 6 ), ( 585, 495, 4 ), ( 585, 540, 2 ),

( 630, 0, 28 ), ( 630, 45, 26 ), ( 630, 90, 24 ), ( 630, 135, 22 ), ( 630, 180, 20 ), ( 630, 225, 18 ), ( 630, 270, 16 ), ( 630, 315, 14 ), ( 630, 360, 12 ), ( 630, 405, 10 ), ( 630, 450, 8 ), ( 630, 495, 6 ), ( 630, 540, 4 ), ( 630, 585, 2 ),

...

}

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)