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

( 48, 0, 29 ),

( 96, 0, 58 ), ( 96, 48, 29 ),

( 144, 0, 87 ), ( 144, 48, 58 ), ( 144, 96, 29 ),

( 192, 0, 116 ), ( 192, 48, 87 ), ( 192, 96, 58 ), ( 192, 144, 29 ),

( 240, 0, 145 ), ( 240, 48, 116 ), ( 240, 96, 87 ), ( 240, 144, 58 ), ( 240, 192, 29 ),

( 288, 0, 174 ), ( 288, 48, 145 ), ( 288, 96, 116 ), ( 288, 144, 87 ), ( 288, 192, 58 ), ( 288, 240, 29 ),

( 336, 0, 203 ), ( 336, 48, 174 ), ( 336, 96, 145 ), ( 336, 144, 116 ), ( 336, 192, 87 ), ( 336, 240, 58 ), ( 336, 288, 29 ),

( 384, 0, 232 ), ( 384, 48, 203 ), ( 384, 96, 174 ), ( 384, 144, 145 ), ( 384, 192, 116 ), ( 384, 240, 87 ), ( 384, 288, 58 ), ( 384, 336, 29 ),

( 432, 0, 261 ), ( 432, 48, 232 ), ( 432, 96, 203 ), ( 432, 144, 174 ), ( 432, 192, 145 ), ( 432, 240, 116 ), ( 432, 288, 87 ), ( 432, 336, 58 ), ( 432, 384, 29 ),

( 480, 0, 290 ), ( 480, 48, 261 ), ( 480, 96, 232 ), ( 480, 144, 203 ), ( 480, 192, 174 ), ( 480, 240, 145 ), ( 480, 288, 116 ), ( 480, 336, 87 ), ( 480, 384, 58 ), ( 480, 432, 29 ),

( 528, 0, 319 ), ( 528, 48, 290 ), ( 528, 96, 261 ), ( 528, 144, 232 ), ( 528, 192, 203 ), ( 528, 240, 174 ), ( 528, 288, 145 ), ( 528, 336, 116 ), ( 528, 384, 87 ), ( 528, 432, 58 ), ( 528, 480, 29 ),

( 576, 0, 348 ), ( 576, 48, 319 ), ( 576, 96, 290 ), ( 576, 144, 261 ), ( 576, 192, 232 ), ( 576, 240, 203 ), ( 576, 288, 174 ), ( 576, 336, 145 ), ( 576, 384, 116 ), ( 576, 432, 87 ), ( 576, 480, 58 ), ( 576, 528, 29 ),

( 624, 0, 377 ), ( 624, 48, 348 ), ( 624, 96, 319 ), ( 624, 144, 290 ), ( 624, 192, 261 ), ( 624, 240, 232 ), ( 624, 288, 203 ), ( 624, 336, 174 ), ( 624, 384, 145 ), ( 624, 432, 116 ), ( 624, 480, 87 ), ( 624, 528, 58 ), ( 624, 576, 29 ),

( 672, 0, 406 ), ( 672, 48, 377 ), ( 672, 96, 348 ), ( 672, 144, 319 ), ( 672, 192, 290 ), ( 672, 240, 261 ), ( 672, 288, 232 ), ( 672, 336, 203 ), ( 672, 384, 174 ), ( 672, 432, 145 ), ( 672, 480, 116 ), ( 672, 528, 87 ), ( 672, 576, 58 ), ( 672, 624, 29 ),

...

}

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)