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

( 48, 0, 25 ),

( 96, 0, 50 ), ( 96, 48, 25 ),

( 144, 0, 75 ), ( 144, 48, 50 ), ( 144, 96, 25 ),

( 192, 0, 100 ), ( 192, 48, 75 ), ( 192, 96, 50 ), ( 192, 144, 25 ),

( 240, 0, 125 ), ( 240, 48, 100 ), ( 240, 96, 75 ), ( 240, 144, 50 ), ( 240, 192, 25 ),

( 288, 0, 150 ), ( 288, 48, 125 ), ( 288, 96, 100 ), ( 288, 144, 75 ), ( 288, 192, 50 ), ( 288, 240, 25 ),

( 336, 0, 175 ), ( 336, 48, 150 ), ( 336, 96, 125 ), ( 336, 144, 100 ), ( 336, 192, 75 ), ( 336, 240, 50 ), ( 336, 288, 25 ),

( 384, 0, 200 ), ( 384, 48, 175 ), ( 384, 96, 150 ), ( 384, 144, 125 ), ( 384, 192, 100 ), ( 384, 240, 75 ), ( 384, 288, 50 ), ( 384, 336, 25 ),

( 432, 0, 225 ), ( 432, 48, 200 ), ( 432, 96, 175 ), ( 432, 144, 150 ), ( 432, 192, 125 ), ( 432, 240, 100 ), ( 432, 288, 75 ), ( 432, 336, 50 ), ( 432, 384, 25 ),

( 480, 0, 250 ), ( 480, 48, 225 ), ( 480, 96, 200 ), ( 480, 144, 175 ), ( 480, 192, 150 ), ( 480, 240, 125 ), ( 480, 288, 100 ), ( 480, 336, 75 ), ( 480, 384, 50 ), ( 480, 432, 25 ),

( 528, 0, 275 ), ( 528, 48, 250 ), ( 528, 96, 225 ), ( 528, 144, 200 ), ( 528, 192, 175 ), ( 528, 240, 150 ), ( 528, 288, 125 ), ( 528, 336, 100 ), ( 528, 384, 75 ), ( 528, 432, 50 ), ( 528, 480, 25 ),

( 576, 0, 300 ), ( 576, 48, 275 ), ( 576, 96, 250 ), ( 576, 144, 225 ), ( 576, 192, 200 ), ( 576, 240, 175 ), ( 576, 288, 150 ), ( 576, 336, 125 ), ( 576, 384, 100 ), ( 576, 432, 75 ), ( 576, 480, 50 ), ( 576, 528, 25 ),

( 624, 0, 325 ), ( 624, 48, 300 ), ( 624, 96, 275 ), ( 624, 144, 250 ), ( 624, 192, 225 ), ( 624, 240, 200 ), ( 624, 288, 175 ), ( 624, 336, 150 ), ( 624, 384, 125 ), ( 624, 432, 100 ), ( 624, 480, 75 ), ( 624, 528, 50 ), ( 624, 576, 25 ),

( 672, 0, 350 ), ( 672, 48, 325 ), ( 672, 96, 300 ), ( 672, 144, 275 ), ( 672, 192, 250 ), ( 672, 240, 225 ), ( 672, 288, 200 ), ( 672, 336, 175 ), ( 672, 384, 150 ), ( 672, 432, 125 ), ( 672, 480, 100 ), ( 672, 528, 75 ), ( 672, 576, 50 ), ( 672, 624, 25 ),

...

}

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)