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

( 49, 0, 17 ),

( 98, 0, 34 ), ( 98, 49, 17 ),

( 147, 0, 51 ), ( 147, 49, 34 ), ( 147, 98, 17 ),

( 196, 0, 68 ), ( 196, 49, 51 ), ( 196, 98, 34 ), ( 196, 147, 17 ),

( 245, 0, 85 ), ( 245, 49, 68 ), ( 245, 98, 51 ), ( 245, 147, 34 ), ( 245, 196, 17 ),

( 294, 0, 102 ), ( 294, 49, 85 ), ( 294, 98, 68 ), ( 294, 147, 51 ), ( 294, 196, 34 ), ( 294, 245, 17 ),

( 343, 0, 119 ), ( 343, 49, 102 ), ( 343, 98, 85 ), ( 343, 147, 68 ), ( 343, 196, 51 ), ( 343, 245, 34 ), ( 343, 294, 17 ),

( 392, 0, 136 ), ( 392, 49, 119 ), ( 392, 98, 102 ), ( 392, 147, 85 ), ( 392, 196, 68 ), ( 392, 245, 51 ), ( 392, 294, 34 ), ( 392, 343, 17 ),

( 441, 0, 153 ), ( 441, 49, 136 ), ( 441, 98, 119 ), ( 441, 147, 102 ), ( 441, 196, 85 ), ( 441, 245, 68 ), ( 441, 294, 51 ), ( 441, 343, 34 ), ( 441, 392, 17 ),

( 490, 0, 170 ), ( 490, 49, 153 ), ( 490, 98, 136 ), ( 490, 147, 119 ), ( 490, 196, 102 ), ( 490, 245, 85 ), ( 490, 294, 68 ), ( 490, 343, 51 ), ( 490, 392, 34 ), ( 490, 441, 17 ),

( 539, 0, 187 ), ( 539, 49, 170 ), ( 539, 98, 153 ), ( 539, 147, 136 ), ( 539, 196, 119 ), ( 539, 245, 102 ), ( 539, 294, 85 ), ( 539, 343, 68 ), ( 539, 392, 51 ), ( 539, 441, 34 ), ( 539, 490, 17 ),

( 588, 0, 204 ), ( 588, 49, 187 ), ( 588, 98, 170 ), ( 588, 147, 153 ), ( 588, 196, 136 ), ( 588, 245, 119 ), ( 588, 294, 102 ), ( 588, 343, 85 ), ( 588, 392, 68 ), ( 588, 441, 51 ), ( 588, 490, 34 ), ( 588, 539, 17 ),

( 637, 0, 221 ), ( 637, 49, 204 ), ( 637, 98, 187 ), ( 637, 147, 170 ), ( 637, 196, 153 ), ( 637, 245, 136 ), ( 637, 294, 119 ), ( 637, 343, 102 ), ( 637, 392, 85 ), ( 637, 441, 68 ), ( 637, 490, 51 ), ( 637, 539, 34 ), ( 637, 588, 17 ),

( 686, 0, 238 ), ( 686, 49, 221 ), ( 686, 98, 204 ), ( 686, 147, 187 ), ( 686, 196, 170 ), ( 686, 245, 153 ), ( 686, 294, 136 ), ( 686, 343, 119 ), ( 686, 392, 102 ), ( 686, 441, 85 ), ( 686, 490, 68 ), ( 686, 539, 51 ), ( 686, 588, 34 ), ( 686, 637, 17 ),

...

}

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)