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

( 45, 0, 26 ),

( 90, 0, 52 ), ( 90, 45, 26 ),

( 135, 0, 78 ), ( 135, 45, 52 ), ( 135, 90, 26 ),

( 180, 0, 104 ), ( 180, 45, 78 ), ( 180, 90, 52 ), ( 180, 135, 26 ),

( 225, 0, 130 ), ( 225, 45, 104 ), ( 225, 90, 78 ), ( 225, 135, 52 ), ( 225, 180, 26 ),

( 270, 0, 156 ), ( 270, 45, 130 ), ( 270, 90, 104 ), ( 270, 135, 78 ), ( 270, 180, 52 ), ( 270, 225, 26 ),

( 315, 0, 182 ), ( 315, 45, 156 ), ( 315, 90, 130 ), ( 315, 135, 104 ), ( 315, 180, 78 ), ( 315, 225, 52 ), ( 315, 270, 26 ),

( 360, 0, 208 ), ( 360, 45, 182 ), ( 360, 90, 156 ), ( 360, 135, 130 ), ( 360, 180, 104 ), ( 360, 225, 78 ), ( 360, 270, 52 ), ( 360, 315, 26 ),

( 405, 0, 234 ), ( 405, 45, 208 ), ( 405, 90, 182 ), ( 405, 135, 156 ), ( 405, 180, 130 ), ( 405, 225, 104 ), ( 405, 270, 78 ), ( 405, 315, 52 ), ( 405, 360, 26 ),

( 450, 0, 260 ), ( 450, 45, 234 ), ( 450, 90, 208 ), ( 450, 135, 182 ), ( 450, 180, 156 ), ( 450, 225, 130 ), ( 450, 270, 104 ), ( 450, 315, 78 ), ( 450, 360, 52 ), ( 450, 405, 26 ),

( 495, 0, 286 ), ( 495, 45, 260 ), ( 495, 90, 234 ), ( 495, 135, 208 ), ( 495, 180, 182 ), ( 495, 225, 156 ), ( 495, 270, 130 ), ( 495, 315, 104 ), ( 495, 360, 78 ), ( 495, 405, 52 ), ( 495, 450, 26 ),

( 540, 0, 312 ), ( 540, 45, 286 ), ( 540, 90, 260 ), ( 540, 135, 234 ), ( 540, 180, 208 ), ( 540, 225, 182 ), ( 540, 270, 156 ), ( 540, 315, 130 ), ( 540, 360, 104 ), ( 540, 405, 78 ), ( 540, 450, 52 ), ( 540, 495, 26 ),

( 585, 0, 338 ), ( 585, 45, 312 ), ( 585, 90, 286 ), ( 585, 135, 260 ), ( 585, 180, 234 ), ( 585, 225, 208 ), ( 585, 270, 182 ), ( 585, 315, 156 ), ( 585, 360, 130 ), ( 585, 405, 104 ), ( 585, 450, 78 ), ( 585, 495, 52 ), ( 585, 540, 26 ),

( 630, 0, 364 ), ( 630, 45, 338 ), ( 630, 90, 312 ), ( 630, 135, 286 ), ( 630, 180, 260 ), ( 630, 225, 234 ), ( 630, 270, 208 ), ( 630, 315, 182 ), ( 630, 360, 156 ), ( 630, 405, 130 ), ( 630, 450, 104 ), ( 630, 495, 78 ), ( 630, 540, 52 ), ( 630, 585, 26 ),

...

}

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)