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

( 49, 0, 16 ),

( 98, 0, 32 ), ( 98, 49, 16 ),

( 147, 0, 48 ), ( 147, 49, 32 ), ( 147, 98, 16 ),

( 196, 0, 64 ), ( 196, 49, 48 ), ( 196, 98, 32 ), ( 196, 147, 16 ),

( 245, 0, 80 ), ( 245, 49, 64 ), ( 245, 98, 48 ), ( 245, 147, 32 ), ( 245, 196, 16 ),

( 294, 0, 96 ), ( 294, 49, 80 ), ( 294, 98, 64 ), ( 294, 147, 48 ), ( 294, 196, 32 ), ( 294, 245, 16 ),

( 343, 0, 112 ), ( 343, 49, 96 ), ( 343, 98, 80 ), ( 343, 147, 64 ), ( 343, 196, 48 ), ( 343, 245, 32 ), ( 343, 294, 16 ),

( 392, 0, 128 ), ( 392, 49, 112 ), ( 392, 98, 96 ), ( 392, 147, 80 ), ( 392, 196, 64 ), ( 392, 245, 48 ), ( 392, 294, 32 ), ( 392, 343, 16 ),

( 441, 0, 144 ), ( 441, 49, 128 ), ( 441, 98, 112 ), ( 441, 147, 96 ), ( 441, 196, 80 ), ( 441, 245, 64 ), ( 441, 294, 48 ), ( 441, 343, 32 ), ( 441, 392, 16 ),

( 490, 0, 160 ), ( 490, 49, 144 ), ( 490, 98, 128 ), ( 490, 147, 112 ), ( 490, 196, 96 ), ( 490, 245, 80 ), ( 490, 294, 64 ), ( 490, 343, 48 ), ( 490, 392, 32 ), ( 490, 441, 16 ),

( 539, 0, 176 ), ( 539, 49, 160 ), ( 539, 98, 144 ), ( 539, 147, 128 ), ( 539, 196, 112 ), ( 539, 245, 96 ), ( 539, 294, 80 ), ( 539, 343, 64 ), ( 539, 392, 48 ), ( 539, 441, 32 ), ( 539, 490, 16 ),

( 588, 0, 192 ), ( 588, 49, 176 ), ( 588, 98, 160 ), ( 588, 147, 144 ), ( 588, 196, 128 ), ( 588, 245, 112 ), ( 588, 294, 96 ), ( 588, 343, 80 ), ( 588, 392, 64 ), ( 588, 441, 48 ), ( 588, 490, 32 ), ( 588, 539, 16 ),

( 637, 0, 208 ), ( 637, 49, 192 ), ( 637, 98, 176 ), ( 637, 147, 160 ), ( 637, 196, 144 ), ( 637, 245, 128 ), ( 637, 294, 112 ), ( 637, 343, 96 ), ( 637, 392, 80 ), ( 637, 441, 64 ), ( 637, 490, 48 ), ( 637, 539, 32 ), ( 637, 588, 16 ),

( 686, 0, 224 ), ( 686, 49, 208 ), ( 686, 98, 192 ), ( 686, 147, 176 ), ( 686, 196, 160 ), ( 686, 245, 144 ), ( 686, 294, 128 ), ( 686, 343, 112 ), ( 686, 392, 96 ), ( 686, 441, 80 ), ( 686, 490, 64 ), ( 686, 539, 48 ), ( 686, 588, 32 ), ( 686, 637, 16 ),

...

}

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)