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

48/23 = (48-0)/23 = {

( 48, 0, 23 ),

( 96, 0, 46 ), ( 96, 48, 23 ),

( 144, 0, 69 ), ( 144, 48, 46 ), ( 144, 96, 23 ),

( 192, 0, 92 ), ( 192, 48, 69 ), ( 192, 96, 46 ), ( 192, 144, 23 ),

( 240, 0, 115 ), ( 240, 48, 92 ), ( 240, 96, 69 ), ( 240, 144, 46 ), ( 240, 192, 23 ),

( 288, 0, 138 ), ( 288, 48, 115 ), ( 288, 96, 92 ), ( 288, 144, 69 ), ( 288, 192, 46 ), ( 288, 240, 23 ),

( 336, 0, 161 ), ( 336, 48, 138 ), ( 336, 96, 115 ), ( 336, 144, 92 ), ( 336, 192, 69 ), ( 336, 240, 46 ), ( 336, 288, 23 ),

( 384, 0, 184 ), ( 384, 48, 161 ), ( 384, 96, 138 ), ( 384, 144, 115 ), ( 384, 192, 92 ), ( 384, 240, 69 ), ( 384, 288, 46 ), ( 384, 336, 23 ),

( 432, 0, 207 ), ( 432, 48, 184 ), ( 432, 96, 161 ), ( 432, 144, 138 ), ( 432, 192, 115 ), ( 432, 240, 92 ), ( 432, 288, 69 ), ( 432, 336, 46 ), ( 432, 384, 23 ),

( 480, 0, 230 ), ( 480, 48, 207 ), ( 480, 96, 184 ), ( 480, 144, 161 ), ( 480, 192, 138 ), ( 480, 240, 115 ), ( 480, 288, 92 ), ( 480, 336, 69 ), ( 480, 384, 46 ), ( 480, 432, 23 ),

( 528, 0, 253 ), ( 528, 48, 230 ), ( 528, 96, 207 ), ( 528, 144, 184 ), ( 528, 192, 161 ), ( 528, 240, 138 ), ( 528, 288, 115 ), ( 528, 336, 92 ), ( 528, 384, 69 ), ( 528, 432, 46 ), ( 528, 480, 23 ),

( 576, 0, 276 ), ( 576, 48, 253 ), ( 576, 96, 230 ), ( 576, 144, 207 ), ( 576, 192, 184 ), ( 576, 240, 161 ), ( 576, 288, 138 ), ( 576, 336, 115 ), ( 576, 384, 92 ), ( 576, 432, 69 ), ( 576, 480, 46 ), ( 576, 528, 23 ),

( 624, 0, 299 ), ( 624, 48, 276 ), ( 624, 96, 253 ), ( 624, 144, 230 ), ( 624, 192, 207 ), ( 624, 240, 184 ), ( 624, 288, 161 ), ( 624, 336, 138 ), ( 624, 384, 115 ), ( 624, 432, 92 ), ( 624, 480, 69 ), ( 624, 528, 46 ), ( 624, 576, 23 ),

( 672, 0, 322 ), ( 672, 48, 299 ), ( 672, 96, 276 ), ( 672, 144, 253 ), ( 672, 192, 230 ), ( 672, 240, 207 ), ( 672, 288, 184 ), ( 672, 336, 161 ), ( 672, 384, 138 ), ( 672, 432, 115 ), ( 672, 480, 92 ), ( 672, 528, 69 ), ( 672, 576, 46 ), ( 672, 624, 23 ),

...

}

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)