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

49/31 = (49-0)/31 = {

( 49, 0, 31 ),

( 98, 0, 62 ), ( 98, 49, 31 ),

( 147, 0, 93 ), ( 147, 49, 62 ), ( 147, 98, 31 ),

( 196, 0, 124 ), ( 196, 49, 93 ), ( 196, 98, 62 ), ( 196, 147, 31 ),

( 245, 0, 155 ), ( 245, 49, 124 ), ( 245, 98, 93 ), ( 245, 147, 62 ), ( 245, 196, 31 ),

( 294, 0, 186 ), ( 294, 49, 155 ), ( 294, 98, 124 ), ( 294, 147, 93 ), ( 294, 196, 62 ), ( 294, 245, 31 ),

( 343, 0, 217 ), ( 343, 49, 186 ), ( 343, 98, 155 ), ( 343, 147, 124 ), ( 343, 196, 93 ), ( 343, 245, 62 ), ( 343, 294, 31 ),

( 392, 0, 248 ), ( 392, 49, 217 ), ( 392, 98, 186 ), ( 392, 147, 155 ), ( 392, 196, 124 ), ( 392, 245, 93 ), ( 392, 294, 62 ), ( 392, 343, 31 ),

( 441, 0, 279 ), ( 441, 49, 248 ), ( 441, 98, 217 ), ( 441, 147, 186 ), ( 441, 196, 155 ), ( 441, 245, 124 ), ( 441, 294, 93 ), ( 441, 343, 62 ), ( 441, 392, 31 ),

( 490, 0, 310 ), ( 490, 49, 279 ), ( 490, 98, 248 ), ( 490, 147, 217 ), ( 490, 196, 186 ), ( 490, 245, 155 ), ( 490, 294, 124 ), ( 490, 343, 93 ), ( 490, 392, 62 ), ( 490, 441, 31 ),

( 539, 0, 341 ), ( 539, 49, 310 ), ( 539, 98, 279 ), ( 539, 147, 248 ), ( 539, 196, 217 ), ( 539, 245, 186 ), ( 539, 294, 155 ), ( 539, 343, 124 ), ( 539, 392, 93 ), ( 539, 441, 62 ), ( 539, 490, 31 ),

( 588, 0, 372 ), ( 588, 49, 341 ), ( 588, 98, 310 ), ( 588, 147, 279 ), ( 588, 196, 248 ), ( 588, 245, 217 ), ( 588, 294, 186 ), ( 588, 343, 155 ), ( 588, 392, 124 ), ( 588, 441, 93 ), ( 588, 490, 62 ), ( 588, 539, 31 ),

( 637, 0, 403 ), ( 637, 49, 372 ), ( 637, 98, 341 ), ( 637, 147, 310 ), ( 637, 196, 279 ), ( 637, 245, 248 ), ( 637, 294, 217 ), ( 637, 343, 186 ), ( 637, 392, 155 ), ( 637, 441, 124 ), ( 637, 490, 93 ), ( 637, 539, 62 ), ( 637, 588, 31 ),

( 686, 0, 434 ), ( 686, 49, 403 ), ( 686, 98, 372 ), ( 686, 147, 341 ), ( 686, 196, 310 ), ( 686, 245, 279 ), ( 686, 294, 248 ), ( 686, 343, 217 ), ( 686, 392, 186 ), ( 686, 441, 155 ), ( 686, 490, 124 ), ( 686, 539, 93 ), ( 686, 588, 62 ), ( 686, 637, 31 ),

...

}

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)