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

( 37, 0, 7 ),

( 74, 0, 14 ), ( 74, 37, 7 ),

( 111, 0, 21 ), ( 111, 37, 14 ), ( 111, 74, 7 ),

( 148, 0, 28 ), ( 148, 37, 21 ), ( 148, 74, 14 ), ( 148, 111, 7 ),

( 185, 0, 35 ), ( 185, 37, 28 ), ( 185, 74, 21 ), ( 185, 111, 14 ), ( 185, 148, 7 ),

( 222, 0, 42 ), ( 222, 37, 35 ), ( 222, 74, 28 ), ( 222, 111, 21 ), ( 222, 148, 14 ), ( 222, 185, 7 ),

( 259, 0, 49 ), ( 259, 37, 42 ), ( 259, 74, 35 ), ( 259, 111, 28 ), ( 259, 148, 21 ), ( 259, 185, 14 ), ( 259, 222, 7 ),

( 296, 0, 56 ), ( 296, 37, 49 ), ( 296, 74, 42 ), ( 296, 111, 35 ), ( 296, 148, 28 ), ( 296, 185, 21 ), ( 296, 222, 14 ), ( 296, 259, 7 ),

( 333, 0, 63 ), ( 333, 37, 56 ), ( 333, 74, 49 ), ( 333, 111, 42 ), ( 333, 148, 35 ), ( 333, 185, 28 ), ( 333, 222, 21 ), ( 333, 259, 14 ), ( 333, 296, 7 ),

( 370, 0, 70 ), ( 370, 37, 63 ), ( 370, 74, 56 ), ( 370, 111, 49 ), ( 370, 148, 42 ), ( 370, 185, 35 ), ( 370, 222, 28 ), ( 370, 259, 21 ), ( 370, 296, 14 ), ( 370, 333, 7 ),

( 407, 0, 77 ), ( 407, 37, 70 ), ( 407, 74, 63 ), ( 407, 111, 56 ), ( 407, 148, 49 ), ( 407, 185, 42 ), ( 407, 222, 35 ), ( 407, 259, 28 ), ( 407, 296, 21 ), ( 407, 333, 14 ), ( 407, 370, 7 ),

( 444, 0, 84 ), ( 444, 37, 77 ), ( 444, 74, 70 ), ( 444, 111, 63 ), ( 444, 148, 56 ), ( 444, 185, 49 ), ( 444, 222, 42 ), ( 444, 259, 35 ), ( 444, 296, 28 ), ( 444, 333, 21 ), ( 444, 370, 14 ), ( 444, 407, 7 ),

( 481, 0, 91 ), ( 481, 37, 84 ), ( 481, 74, 77 ), ( 481, 111, 70 ), ( 481, 148, 63 ), ( 481, 185, 56 ), ( 481, 222, 49 ), ( 481, 259, 42 ), ( 481, 296, 35 ), ( 481, 333, 28 ), ( 481, 370, 21 ), ( 481, 407, 14 ), ( 481, 444, 7 ),

( 518, 0, 98 ), ( 518, 37, 91 ), ( 518, 74, 84 ), ( 518, 111, 77 ), ( 518, 148, 70 ), ( 518, 185, 63 ), ( 518, 222, 56 ), ( 518, 259, 49 ), ( 518, 296, 42 ), ( 518, 333, 35 ), ( 518, 370, 28 ), ( 518, 407, 21 ), ( 518, 444, 14 ), ( 518, 481, 7 ),

...

}

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)