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

( 49, 0, 18 ),

( 98, 0, 36 ), ( 98, 49, 18 ),

( 147, 0, 54 ), ( 147, 49, 36 ), ( 147, 98, 18 ),

( 196, 0, 72 ), ( 196, 49, 54 ), ( 196, 98, 36 ), ( 196, 147, 18 ),

( 245, 0, 90 ), ( 245, 49, 72 ), ( 245, 98, 54 ), ( 245, 147, 36 ), ( 245, 196, 18 ),

( 294, 0, 108 ), ( 294, 49, 90 ), ( 294, 98, 72 ), ( 294, 147, 54 ), ( 294, 196, 36 ), ( 294, 245, 18 ),

( 343, 0, 126 ), ( 343, 49, 108 ), ( 343, 98, 90 ), ( 343, 147, 72 ), ( 343, 196, 54 ), ( 343, 245, 36 ), ( 343, 294, 18 ),

( 392, 0, 144 ), ( 392, 49, 126 ), ( 392, 98, 108 ), ( 392, 147, 90 ), ( 392, 196, 72 ), ( 392, 245, 54 ), ( 392, 294, 36 ), ( 392, 343, 18 ),

( 441, 0, 162 ), ( 441, 49, 144 ), ( 441, 98, 126 ), ( 441, 147, 108 ), ( 441, 196, 90 ), ( 441, 245, 72 ), ( 441, 294, 54 ), ( 441, 343, 36 ), ( 441, 392, 18 ),

( 490, 0, 180 ), ( 490, 49, 162 ), ( 490, 98, 144 ), ( 490, 147, 126 ), ( 490, 196, 108 ), ( 490, 245, 90 ), ( 490, 294, 72 ), ( 490, 343, 54 ), ( 490, 392, 36 ), ( 490, 441, 18 ),

( 539, 0, 198 ), ( 539, 49, 180 ), ( 539, 98, 162 ), ( 539, 147, 144 ), ( 539, 196, 126 ), ( 539, 245, 108 ), ( 539, 294, 90 ), ( 539, 343, 72 ), ( 539, 392, 54 ), ( 539, 441, 36 ), ( 539, 490, 18 ),

( 588, 0, 216 ), ( 588, 49, 198 ), ( 588, 98, 180 ), ( 588, 147, 162 ), ( 588, 196, 144 ), ( 588, 245, 126 ), ( 588, 294, 108 ), ( 588, 343, 90 ), ( 588, 392, 72 ), ( 588, 441, 54 ), ( 588, 490, 36 ), ( 588, 539, 18 ),

( 637, 0, 234 ), ( 637, 49, 216 ), ( 637, 98, 198 ), ( 637, 147, 180 ), ( 637, 196, 162 ), ( 637, 245, 144 ), ( 637, 294, 126 ), ( 637, 343, 108 ), ( 637, 392, 90 ), ( 637, 441, 72 ), ( 637, 490, 54 ), ( 637, 539, 36 ), ( 637, 588, 18 ),

( 686, 0, 252 ), ( 686, 49, 234 ), ( 686, 98, 216 ), ( 686, 147, 198 ), ( 686, 196, 180 ), ( 686, 245, 162 ), ( 686, 294, 144 ), ( 686, 343, 126 ), ( 686, 392, 108 ), ( 686, 441, 90 ), ( 686, 490, 72 ), ( 686, 539, 54 ), ( 686, 588, 36 ), ( 686, 637, 18 ),

...

}

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)