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

( 49, 0, 23 ),

( 98, 0, 46 ), ( 98, 49, 23 ),

( 147, 0, 69 ), ( 147, 49, 46 ), ( 147, 98, 23 ),

( 196, 0, 92 ), ( 196, 49, 69 ), ( 196, 98, 46 ), ( 196, 147, 23 ),

( 245, 0, 115 ), ( 245, 49, 92 ), ( 245, 98, 69 ), ( 245, 147, 46 ), ( 245, 196, 23 ),

( 294, 0, 138 ), ( 294, 49, 115 ), ( 294, 98, 92 ), ( 294, 147, 69 ), ( 294, 196, 46 ), ( 294, 245, 23 ),

( 343, 0, 161 ), ( 343, 49, 138 ), ( 343, 98, 115 ), ( 343, 147, 92 ), ( 343, 196, 69 ), ( 343, 245, 46 ), ( 343, 294, 23 ),

( 392, 0, 184 ), ( 392, 49, 161 ), ( 392, 98, 138 ), ( 392, 147, 115 ), ( 392, 196, 92 ), ( 392, 245, 69 ), ( 392, 294, 46 ), ( 392, 343, 23 ),

( 441, 0, 207 ), ( 441, 49, 184 ), ( 441, 98, 161 ), ( 441, 147, 138 ), ( 441, 196, 115 ), ( 441, 245, 92 ), ( 441, 294, 69 ), ( 441, 343, 46 ), ( 441, 392, 23 ),

( 490, 0, 230 ), ( 490, 49, 207 ), ( 490, 98, 184 ), ( 490, 147, 161 ), ( 490, 196, 138 ), ( 490, 245, 115 ), ( 490, 294, 92 ), ( 490, 343, 69 ), ( 490, 392, 46 ), ( 490, 441, 23 ),

( 539, 0, 253 ), ( 539, 49, 230 ), ( 539, 98, 207 ), ( 539, 147, 184 ), ( 539, 196, 161 ), ( 539, 245, 138 ), ( 539, 294, 115 ), ( 539, 343, 92 ), ( 539, 392, 69 ), ( 539, 441, 46 ), ( 539, 490, 23 ),

( 588, 0, 276 ), ( 588, 49, 253 ), ( 588, 98, 230 ), ( 588, 147, 207 ), ( 588, 196, 184 ), ( 588, 245, 161 ), ( 588, 294, 138 ), ( 588, 343, 115 ), ( 588, 392, 92 ), ( 588, 441, 69 ), ( 588, 490, 46 ), ( 588, 539, 23 ),

( 637, 0, 299 ), ( 637, 49, 276 ), ( 637, 98, 253 ), ( 637, 147, 230 ), ( 637, 196, 207 ), ( 637, 245, 184 ), ( 637, 294, 161 ), ( 637, 343, 138 ), ( 637, 392, 115 ), ( 637, 441, 92 ), ( 637, 490, 69 ), ( 637, 539, 46 ), ( 637, 588, 23 ),

( 686, 0, 322 ), ( 686, 49, 299 ), ( 686, 98, 276 ), ( 686, 147, 253 ), ( 686, 196, 230 ), ( 686, 245, 207 ), ( 686, 294, 184 ), ( 686, 343, 161 ), ( 686, 392, 138 ), ( 686, 441, 115 ), ( 686, 490, 92 ), ( 686, 539, 69 ), ( 686, 588, 46 ), ( 686, 637, 23 ),

...

}

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)