The rational number 44/9 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.

44/9 = (44-0)/9 = {

( 44, 0, 9 ),

( 88, 0, 18 ), ( 88, 44, 9 ),

( 132, 0, 27 ), ( 132, 44, 18 ), ( 132, 88, 9 ),

( 176, 0, 36 ), ( 176, 44, 27 ), ( 176, 88, 18 ), ( 176, 132, 9 ),

( 220, 0, 45 ), ( 220, 44, 36 ), ( 220, 88, 27 ), ( 220, 132, 18 ), ( 220, 176, 9 ),

( 264, 0, 54 ), ( 264, 44, 45 ), ( 264, 88, 36 ), ( 264, 132, 27 ), ( 264, 176, 18 ), ( 264, 220, 9 ),

( 308, 0, 63 ), ( 308, 44, 54 ), ( 308, 88, 45 ), ( 308, 132, 36 ), ( 308, 176, 27 ), ( 308, 220, 18 ), ( 308, 264, 9 ),

( 352, 0, 72 ), ( 352, 44, 63 ), ( 352, 88, 54 ), ( 352, 132, 45 ), ( 352, 176, 36 ), ( 352, 220, 27 ), ( 352, 264, 18 ), ( 352, 308, 9 ),

( 396, 0, 81 ), ( 396, 44, 72 ), ( 396, 88, 63 ), ( 396, 132, 54 ), ( 396, 176, 45 ), ( 396, 220, 36 ), ( 396, 264, 27 ), ( 396, 308, 18 ), ( 396, 352, 9 ),

( 440, 0, 90 ), ( 440, 44, 81 ), ( 440, 88, 72 ), ( 440, 132, 63 ), ( 440, 176, 54 ), ( 440, 220, 45 ), ( 440, 264, 36 ), ( 440, 308, 27 ), ( 440, 352, 18 ), ( 440, 396, 9 ),

( 484, 0, 99 ), ( 484, 44, 90 ), ( 484, 88, 81 ), ( 484, 132, 72 ), ( 484, 176, 63 ), ( 484, 220, 54 ), ( 484, 264, 45 ), ( 484, 308, 36 ), ( 484, 352, 27 ), ( 484, 396, 18 ), ( 484, 440, 9 ),

( 528, 0, 108 ), ( 528, 44, 99 ), ( 528, 88, 90 ), ( 528, 132, 81 ), ( 528, 176, 72 ), ( 528, 220, 63 ), ( 528, 264, 54 ), ( 528, 308, 45 ), ( 528, 352, 36 ), ( 528, 396, 27 ), ( 528, 440, 18 ), ( 528, 484, 9 ),

( 572, 0, 117 ), ( 572, 44, 108 ), ( 572, 88, 99 ), ( 572, 132, 90 ), ( 572, 176, 81 ), ( 572, 220, 72 ), ( 572, 264, 63 ), ( 572, 308, 54 ), ( 572, 352, 45 ), ( 572, 396, 36 ), ( 572, 440, 27 ), ( 572, 484, 18 ), ( 572, 528, 9 ),

( 616, 0, 126 ), ( 616, 44, 117 ), ( 616, 88, 108 ), ( 616, 132, 99 ), ( 616, 176, 90 ), ( 616, 220, 81 ), ( 616, 264, 72 ), ( 616, 308, 63 ), ( 616, 352, 54 ), ( 616, 396, 45 ), ( 616, 440, 36 ), ( 616, 484, 27 ), ( 616, 528, 18 ), ( 616, 572, 9 ),

...

}

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)