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

46/29 = (46-0)/29 = {

( 46, 0, 29 ),

( 92, 0, 58 ), ( 92, 46, 29 ),

( 138, 0, 87 ), ( 138, 46, 58 ), ( 138, 92, 29 ),

( 184, 0, 116 ), ( 184, 46, 87 ), ( 184, 92, 58 ), ( 184, 138, 29 ),

( 230, 0, 145 ), ( 230, 46, 116 ), ( 230, 92, 87 ), ( 230, 138, 58 ), ( 230, 184, 29 ),

( 276, 0, 174 ), ( 276, 46, 145 ), ( 276, 92, 116 ), ( 276, 138, 87 ), ( 276, 184, 58 ), ( 276, 230, 29 ),

( 322, 0, 203 ), ( 322, 46, 174 ), ( 322, 92, 145 ), ( 322, 138, 116 ), ( 322, 184, 87 ), ( 322, 230, 58 ), ( 322, 276, 29 ),

( 368, 0, 232 ), ( 368, 46, 203 ), ( 368, 92, 174 ), ( 368, 138, 145 ), ( 368, 184, 116 ), ( 368, 230, 87 ), ( 368, 276, 58 ), ( 368, 322, 29 ),

( 414, 0, 261 ), ( 414, 46, 232 ), ( 414, 92, 203 ), ( 414, 138, 174 ), ( 414, 184, 145 ), ( 414, 230, 116 ), ( 414, 276, 87 ), ( 414, 322, 58 ), ( 414, 368, 29 ),

( 460, 0, 290 ), ( 460, 46, 261 ), ( 460, 92, 232 ), ( 460, 138, 203 ), ( 460, 184, 174 ), ( 460, 230, 145 ), ( 460, 276, 116 ), ( 460, 322, 87 ), ( 460, 368, 58 ), ( 460, 414, 29 ),

( 506, 0, 319 ), ( 506, 46, 290 ), ( 506, 92, 261 ), ( 506, 138, 232 ), ( 506, 184, 203 ), ( 506, 230, 174 ), ( 506, 276, 145 ), ( 506, 322, 116 ), ( 506, 368, 87 ), ( 506, 414, 58 ), ( 506, 460, 29 ),

( 552, 0, 348 ), ( 552, 46, 319 ), ( 552, 92, 290 ), ( 552, 138, 261 ), ( 552, 184, 232 ), ( 552, 230, 203 ), ( 552, 276, 174 ), ( 552, 322, 145 ), ( 552, 368, 116 ), ( 552, 414, 87 ), ( 552, 460, 58 ), ( 552, 506, 29 ),

( 598, 0, 377 ), ( 598, 46, 348 ), ( 598, 92, 319 ), ( 598, 138, 290 ), ( 598, 184, 261 ), ( 598, 230, 232 ), ( 598, 276, 203 ), ( 598, 322, 174 ), ( 598, 368, 145 ), ( 598, 414, 116 ), ( 598, 460, 87 ), ( 598, 506, 58 ), ( 598, 552, 29 ),

( 644, 0, 406 ), ( 644, 46, 377 ), ( 644, 92, 348 ), ( 644, 138, 319 ), ( 644, 184, 290 ), ( 644, 230, 261 ), ( 644, 276, 232 ), ( 644, 322, 203 ), ( 644, 368, 174 ), ( 644, 414, 145 ), ( 644, 460, 116 ), ( 644, 506, 87 ), ( 644, 552, 58 ), ( 644, 598, 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)