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

( 49, 0, 13 ),

( 98, 0, 26 ), ( 98, 49, 13 ),

( 147, 0, 39 ), ( 147, 49, 26 ), ( 147, 98, 13 ),

( 196, 0, 52 ), ( 196, 49, 39 ), ( 196, 98, 26 ), ( 196, 147, 13 ),

( 245, 0, 65 ), ( 245, 49, 52 ), ( 245, 98, 39 ), ( 245, 147, 26 ), ( 245, 196, 13 ),

( 294, 0, 78 ), ( 294, 49, 65 ), ( 294, 98, 52 ), ( 294, 147, 39 ), ( 294, 196, 26 ), ( 294, 245, 13 ),

( 343, 0, 91 ), ( 343, 49, 78 ), ( 343, 98, 65 ), ( 343, 147, 52 ), ( 343, 196, 39 ), ( 343, 245, 26 ), ( 343, 294, 13 ),

( 392, 0, 104 ), ( 392, 49, 91 ), ( 392, 98, 78 ), ( 392, 147, 65 ), ( 392, 196, 52 ), ( 392, 245, 39 ), ( 392, 294, 26 ), ( 392, 343, 13 ),

( 441, 0, 117 ), ( 441, 49, 104 ), ( 441, 98, 91 ), ( 441, 147, 78 ), ( 441, 196, 65 ), ( 441, 245, 52 ), ( 441, 294, 39 ), ( 441, 343, 26 ), ( 441, 392, 13 ),

( 490, 0, 130 ), ( 490, 49, 117 ), ( 490, 98, 104 ), ( 490, 147, 91 ), ( 490, 196, 78 ), ( 490, 245, 65 ), ( 490, 294, 52 ), ( 490, 343, 39 ), ( 490, 392, 26 ), ( 490, 441, 13 ),

( 539, 0, 143 ), ( 539, 49, 130 ), ( 539, 98, 117 ), ( 539, 147, 104 ), ( 539, 196, 91 ), ( 539, 245, 78 ), ( 539, 294, 65 ), ( 539, 343, 52 ), ( 539, 392, 39 ), ( 539, 441, 26 ), ( 539, 490, 13 ),

( 588, 0, 156 ), ( 588, 49, 143 ), ( 588, 98, 130 ), ( 588, 147, 117 ), ( 588, 196, 104 ), ( 588, 245, 91 ), ( 588, 294, 78 ), ( 588, 343, 65 ), ( 588, 392, 52 ), ( 588, 441, 39 ), ( 588, 490, 26 ), ( 588, 539, 13 ),

( 637, 0, 169 ), ( 637, 49, 156 ), ( 637, 98, 143 ), ( 637, 147, 130 ), ( 637, 196, 117 ), ( 637, 245, 104 ), ( 637, 294, 91 ), ( 637, 343, 78 ), ( 637, 392, 65 ), ( 637, 441, 52 ), ( 637, 490, 39 ), ( 637, 539, 26 ), ( 637, 588, 13 ),

( 686, 0, 182 ), ( 686, 49, 169 ), ( 686, 98, 156 ), ( 686, 147, 143 ), ( 686, 196, 130 ), ( 686, 245, 117 ), ( 686, 294, 104 ), ( 686, 343, 91 ), ( 686, 392, 78 ), ( 686, 441, 65 ), ( 686, 490, 52 ), ( 686, 539, 39 ), ( 686, 588, 26 ), ( 686, 637, 13 ),

...

}

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)