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

( 45, 0, 7 ),

( 90, 0, 14 ), ( 90, 45, 7 ),

( 135, 0, 21 ), ( 135, 45, 14 ), ( 135, 90, 7 ),

( 180, 0, 28 ), ( 180, 45, 21 ), ( 180, 90, 14 ), ( 180, 135, 7 ),

( 225, 0, 35 ), ( 225, 45, 28 ), ( 225, 90, 21 ), ( 225, 135, 14 ), ( 225, 180, 7 ),

( 270, 0, 42 ), ( 270, 45, 35 ), ( 270, 90, 28 ), ( 270, 135, 21 ), ( 270, 180, 14 ), ( 270, 225, 7 ),

( 315, 0, 49 ), ( 315, 45, 42 ), ( 315, 90, 35 ), ( 315, 135, 28 ), ( 315, 180, 21 ), ( 315, 225, 14 ), ( 315, 270, 7 ),

( 360, 0, 56 ), ( 360, 45, 49 ), ( 360, 90, 42 ), ( 360, 135, 35 ), ( 360, 180, 28 ), ( 360, 225, 21 ), ( 360, 270, 14 ), ( 360, 315, 7 ),

( 405, 0, 63 ), ( 405, 45, 56 ), ( 405, 90, 49 ), ( 405, 135, 42 ), ( 405, 180, 35 ), ( 405, 225, 28 ), ( 405, 270, 21 ), ( 405, 315, 14 ), ( 405, 360, 7 ),

( 450, 0, 70 ), ( 450, 45, 63 ), ( 450, 90, 56 ), ( 450, 135, 49 ), ( 450, 180, 42 ), ( 450, 225, 35 ), ( 450, 270, 28 ), ( 450, 315, 21 ), ( 450, 360, 14 ), ( 450, 405, 7 ),

( 495, 0, 77 ), ( 495, 45, 70 ), ( 495, 90, 63 ), ( 495, 135, 56 ), ( 495, 180, 49 ), ( 495, 225, 42 ), ( 495, 270, 35 ), ( 495, 315, 28 ), ( 495, 360, 21 ), ( 495, 405, 14 ), ( 495, 450, 7 ),

( 540, 0, 84 ), ( 540, 45, 77 ), ( 540, 90, 70 ), ( 540, 135, 63 ), ( 540, 180, 56 ), ( 540, 225, 49 ), ( 540, 270, 42 ), ( 540, 315, 35 ), ( 540, 360, 28 ), ( 540, 405, 21 ), ( 540, 450, 14 ), ( 540, 495, 7 ),

( 585, 0, 91 ), ( 585, 45, 84 ), ( 585, 90, 77 ), ( 585, 135, 70 ), ( 585, 180, 63 ), ( 585, 225, 56 ), ( 585, 270, 49 ), ( 585, 315, 42 ), ( 585, 360, 35 ), ( 585, 405, 28 ), ( 585, 450, 21 ), ( 585, 495, 14 ), ( 585, 540, 7 ),

( 630, 0, 98 ), ( 630, 45, 91 ), ( 630, 90, 84 ), ( 630, 135, 77 ), ( 630, 180, 70 ), ( 630, 225, 63 ), ( 630, 270, 56 ), ( 630, 315, 49 ), ( 630, 360, 42 ), ( 630, 405, 35 ), ( 630, 450, 28 ), ( 630, 495, 21 ), ( 630, 540, 14 ), ( 630, 585, 7 ),

...

}

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)