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

( 48, 0, 17 ),

( 96, 0, 34 ), ( 96, 48, 17 ),

( 144, 0, 51 ), ( 144, 48, 34 ), ( 144, 96, 17 ),

( 192, 0, 68 ), ( 192, 48, 51 ), ( 192, 96, 34 ), ( 192, 144, 17 ),

( 240, 0, 85 ), ( 240, 48, 68 ), ( 240, 96, 51 ), ( 240, 144, 34 ), ( 240, 192, 17 ),

( 288, 0, 102 ), ( 288, 48, 85 ), ( 288, 96, 68 ), ( 288, 144, 51 ), ( 288, 192, 34 ), ( 288, 240, 17 ),

( 336, 0, 119 ), ( 336, 48, 102 ), ( 336, 96, 85 ), ( 336, 144, 68 ), ( 336, 192, 51 ), ( 336, 240, 34 ), ( 336, 288, 17 ),

( 384, 0, 136 ), ( 384, 48, 119 ), ( 384, 96, 102 ), ( 384, 144, 85 ), ( 384, 192, 68 ), ( 384, 240, 51 ), ( 384, 288, 34 ), ( 384, 336, 17 ),

( 432, 0, 153 ), ( 432, 48, 136 ), ( 432, 96, 119 ), ( 432, 144, 102 ), ( 432, 192, 85 ), ( 432, 240, 68 ), ( 432, 288, 51 ), ( 432, 336, 34 ), ( 432, 384, 17 ),

( 480, 0, 170 ), ( 480, 48, 153 ), ( 480, 96, 136 ), ( 480, 144, 119 ), ( 480, 192, 102 ), ( 480, 240, 85 ), ( 480, 288, 68 ), ( 480, 336, 51 ), ( 480, 384, 34 ), ( 480, 432, 17 ),

( 528, 0, 187 ), ( 528, 48, 170 ), ( 528, 96, 153 ), ( 528, 144, 136 ), ( 528, 192, 119 ), ( 528, 240, 102 ), ( 528, 288, 85 ), ( 528, 336, 68 ), ( 528, 384, 51 ), ( 528, 432, 34 ), ( 528, 480, 17 ),

( 576, 0, 204 ), ( 576, 48, 187 ), ( 576, 96, 170 ), ( 576, 144, 153 ), ( 576, 192, 136 ), ( 576, 240, 119 ), ( 576, 288, 102 ), ( 576, 336, 85 ), ( 576, 384, 68 ), ( 576, 432, 51 ), ( 576, 480, 34 ), ( 576, 528, 17 ),

( 624, 0, 221 ), ( 624, 48, 204 ), ( 624, 96, 187 ), ( 624, 144, 170 ), ( 624, 192, 153 ), ( 624, 240, 136 ), ( 624, 288, 119 ), ( 624, 336, 102 ), ( 624, 384, 85 ), ( 624, 432, 68 ), ( 624, 480, 51 ), ( 624, 528, 34 ), ( 624, 576, 17 ),

( 672, 0, 238 ), ( 672, 48, 221 ), ( 672, 96, 204 ), ( 672, 144, 187 ), ( 672, 192, 170 ), ( 672, 240, 153 ), ( 672, 288, 136 ), ( 672, 336, 119 ), ( 672, 384, 102 ), ( 672, 432, 85 ), ( 672, 480, 68 ), ( 672, 528, 51 ), ( 672, 576, 34 ), ( 672, 624, 17 ),

...

}

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)