The rational number 39/1 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.

39/1 = (39-0)/1 = {

( 39, 0, 1 ),

( 78, 0, 2 ), ( 78, 39, 1 ),

( 117, 0, 3 ), ( 117, 39, 2 ), ( 117, 78, 1 ),

( 156, 0, 4 ), ( 156, 39, 3 ), ( 156, 78, 2 ), ( 156, 117, 1 ),

( 195, 0, 5 ), ( 195, 39, 4 ), ( 195, 78, 3 ), ( 195, 117, 2 ), ( 195, 156, 1 ),

( 234, 0, 6 ), ( 234, 39, 5 ), ( 234, 78, 4 ), ( 234, 117, 3 ), ( 234, 156, 2 ), ( 234, 195, 1 ),

( 273, 0, 7 ), ( 273, 39, 6 ), ( 273, 78, 5 ), ( 273, 117, 4 ), ( 273, 156, 3 ), ( 273, 195, 2 ), ( 273, 234, 1 ),

( 312, 0, 8 ), ( 312, 39, 7 ), ( 312, 78, 6 ), ( 312, 117, 5 ), ( 312, 156, 4 ), ( 312, 195, 3 ), ( 312, 234, 2 ), ( 312, 273, 1 ),

( 351, 0, 9 ), ( 351, 39, 8 ), ( 351, 78, 7 ), ( 351, 117, 6 ), ( 351, 156, 5 ), ( 351, 195, 4 ), ( 351, 234, 3 ), ( 351, 273, 2 ), ( 351, 312, 1 ),

( 390, 0, 10 ), ( 390, 39, 9 ), ( 390, 78, 8 ), ( 390, 117, 7 ), ( 390, 156, 6 ), ( 390, 195, 5 ), ( 390, 234, 4 ), ( 390, 273, 3 ), ( 390, 312, 2 ), ( 390, 351, 1 ),

( 429, 0, 11 ), ( 429, 39, 10 ), ( 429, 78, 9 ), ( 429, 117, 8 ), ( 429, 156, 7 ), ( 429, 195, 6 ), ( 429, 234, 5 ), ( 429, 273, 4 ), ( 429, 312, 3 ), ( 429, 351, 2 ), ( 429, 390, 1 ),

( 468, 0, 12 ), ( 468, 39, 11 ), ( 468, 78, 10 ), ( 468, 117, 9 ), ( 468, 156, 8 ), ( 468, 195, 7 ), ( 468, 234, 6 ), ( 468, 273, 5 ), ( 468, 312, 4 ), ( 468, 351, 3 ), ( 468, 390, 2 ), ( 468, 429, 1 ),

( 507, 0, 13 ), ( 507, 39, 12 ), ( 507, 78, 11 ), ( 507, 117, 10 ), ( 507, 156, 9 ), ( 507, 195, 8 ), ( 507, 234, 7 ), ( 507, 273, 6 ), ( 507, 312, 5 ), ( 507, 351, 4 ), ( 507, 390, 3 ), ( 507, 429, 2 ), ( 507, 468, 1 ),

( 546, 0, 14 ), ( 546, 39, 13 ), ( 546, 78, 12 ), ( 546, 117, 11 ), ( 546, 156, 10 ), ( 546, 195, 9 ), ( 546, 234, 8 ), ( 546, 273, 7 ), ( 546, 312, 6 ), ( 546, 351, 5 ), ( 546, 390, 4 ), ( 546, 429, 3 ), ( 546, 468, 2 ), ( 546, 507, 1 ),

...

}

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)