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

( 49, 0, 15 ),

( 98, 0, 30 ), ( 98, 49, 15 ),

( 147, 0, 45 ), ( 147, 49, 30 ), ( 147, 98, 15 ),

( 196, 0, 60 ), ( 196, 49, 45 ), ( 196, 98, 30 ), ( 196, 147, 15 ),

( 245, 0, 75 ), ( 245, 49, 60 ), ( 245, 98, 45 ), ( 245, 147, 30 ), ( 245, 196, 15 ),

( 294, 0, 90 ), ( 294, 49, 75 ), ( 294, 98, 60 ), ( 294, 147, 45 ), ( 294, 196, 30 ), ( 294, 245, 15 ),

( 343, 0, 105 ), ( 343, 49, 90 ), ( 343, 98, 75 ), ( 343, 147, 60 ), ( 343, 196, 45 ), ( 343, 245, 30 ), ( 343, 294, 15 ),

( 392, 0, 120 ), ( 392, 49, 105 ), ( 392, 98, 90 ), ( 392, 147, 75 ), ( 392, 196, 60 ), ( 392, 245, 45 ), ( 392, 294, 30 ), ( 392, 343, 15 ),

( 441, 0, 135 ), ( 441, 49, 120 ), ( 441, 98, 105 ), ( 441, 147, 90 ), ( 441, 196, 75 ), ( 441, 245, 60 ), ( 441, 294, 45 ), ( 441, 343, 30 ), ( 441, 392, 15 ),

( 490, 0, 150 ), ( 490, 49, 135 ), ( 490, 98, 120 ), ( 490, 147, 105 ), ( 490, 196, 90 ), ( 490, 245, 75 ), ( 490, 294, 60 ), ( 490, 343, 45 ), ( 490, 392, 30 ), ( 490, 441, 15 ),

( 539, 0, 165 ), ( 539, 49, 150 ), ( 539, 98, 135 ), ( 539, 147, 120 ), ( 539, 196, 105 ), ( 539, 245, 90 ), ( 539, 294, 75 ), ( 539, 343, 60 ), ( 539, 392, 45 ), ( 539, 441, 30 ), ( 539, 490, 15 ),

( 588, 0, 180 ), ( 588, 49, 165 ), ( 588, 98, 150 ), ( 588, 147, 135 ), ( 588, 196, 120 ), ( 588, 245, 105 ), ( 588, 294, 90 ), ( 588, 343, 75 ), ( 588, 392, 60 ), ( 588, 441, 45 ), ( 588, 490, 30 ), ( 588, 539, 15 ),

( 637, 0, 195 ), ( 637, 49, 180 ), ( 637, 98, 165 ), ( 637, 147, 150 ), ( 637, 196, 135 ), ( 637, 245, 120 ), ( 637, 294, 105 ), ( 637, 343, 90 ), ( 637, 392, 75 ), ( 637, 441, 60 ), ( 637, 490, 45 ), ( 637, 539, 30 ), ( 637, 588, 15 ),

( 686, 0, 210 ), ( 686, 49, 195 ), ( 686, 98, 180 ), ( 686, 147, 165 ), ( 686, 196, 150 ), ( 686, 245, 135 ), ( 686, 294, 120 ), ( 686, 343, 105 ), ( 686, 392, 90 ), ( 686, 441, 75 ), ( 686, 490, 60 ), ( 686, 539, 45 ), ( 686, 588, 30 ), ( 686, 637, 15 ),

...

}

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)