The rational number 37/25 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.

37/25 = (37-0)/25 = {

( 37, 0, 25 ),

( 74, 0, 50 ), ( 74, 37, 25 ),

( 111, 0, 75 ), ( 111, 37, 50 ), ( 111, 74, 25 ),

( 148, 0, 100 ), ( 148, 37, 75 ), ( 148, 74, 50 ), ( 148, 111, 25 ),

( 185, 0, 125 ), ( 185, 37, 100 ), ( 185, 74, 75 ), ( 185, 111, 50 ), ( 185, 148, 25 ),

( 222, 0, 150 ), ( 222, 37, 125 ), ( 222, 74, 100 ), ( 222, 111, 75 ), ( 222, 148, 50 ), ( 222, 185, 25 ),

( 259, 0, 175 ), ( 259, 37, 150 ), ( 259, 74, 125 ), ( 259, 111, 100 ), ( 259, 148, 75 ), ( 259, 185, 50 ), ( 259, 222, 25 ),

( 296, 0, 200 ), ( 296, 37, 175 ), ( 296, 74, 150 ), ( 296, 111, 125 ), ( 296, 148, 100 ), ( 296, 185, 75 ), ( 296, 222, 50 ), ( 296, 259, 25 ),

( 333, 0, 225 ), ( 333, 37, 200 ), ( 333, 74, 175 ), ( 333, 111, 150 ), ( 333, 148, 125 ), ( 333, 185, 100 ), ( 333, 222, 75 ), ( 333, 259, 50 ), ( 333, 296, 25 ),

( 370, 0, 250 ), ( 370, 37, 225 ), ( 370, 74, 200 ), ( 370, 111, 175 ), ( 370, 148, 150 ), ( 370, 185, 125 ), ( 370, 222, 100 ), ( 370, 259, 75 ), ( 370, 296, 50 ), ( 370, 333, 25 ),

( 407, 0, 275 ), ( 407, 37, 250 ), ( 407, 74, 225 ), ( 407, 111, 200 ), ( 407, 148, 175 ), ( 407, 185, 150 ), ( 407, 222, 125 ), ( 407, 259, 100 ), ( 407, 296, 75 ), ( 407, 333, 50 ), ( 407, 370, 25 ),

( 444, 0, 300 ), ( 444, 37, 275 ), ( 444, 74, 250 ), ( 444, 111, 225 ), ( 444, 148, 200 ), ( 444, 185, 175 ), ( 444, 222, 150 ), ( 444, 259, 125 ), ( 444, 296, 100 ), ( 444, 333, 75 ), ( 444, 370, 50 ), ( 444, 407, 25 ),

( 481, 0, 325 ), ( 481, 37, 300 ), ( 481, 74, 275 ), ( 481, 111, 250 ), ( 481, 148, 225 ), ( 481, 185, 200 ), ( 481, 222, 175 ), ( 481, 259, 150 ), ( 481, 296, 125 ), ( 481, 333, 100 ), ( 481, 370, 75 ), ( 481, 407, 50 ), ( 481, 444, 25 ),

( 518, 0, 350 ), ( 518, 37, 325 ), ( 518, 74, 300 ), ( 518, 111, 275 ), ( 518, 148, 250 ), ( 518, 185, 225 ), ( 518, 222, 200 ), ( 518, 259, 175 ), ( 518, 296, 150 ), ( 518, 333, 125 ), ( 518, 370, 100 ), ( 518, 407, 75 ), ( 518, 444, 50 ), ( 518, 481, 25 ),

...

}

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)