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

( 44, 0, 23 ),

( 88, 0, 46 ), ( 88, 44, 23 ),

( 132, 0, 69 ), ( 132, 44, 46 ), ( 132, 88, 23 ),

( 176, 0, 92 ), ( 176, 44, 69 ), ( 176, 88, 46 ), ( 176, 132, 23 ),

( 220, 0, 115 ), ( 220, 44, 92 ), ( 220, 88, 69 ), ( 220, 132, 46 ), ( 220, 176, 23 ),

( 264, 0, 138 ), ( 264, 44, 115 ), ( 264, 88, 92 ), ( 264, 132, 69 ), ( 264, 176, 46 ), ( 264, 220, 23 ),

( 308, 0, 161 ), ( 308, 44, 138 ), ( 308, 88, 115 ), ( 308, 132, 92 ), ( 308, 176, 69 ), ( 308, 220, 46 ), ( 308, 264, 23 ),

( 352, 0, 184 ), ( 352, 44, 161 ), ( 352, 88, 138 ), ( 352, 132, 115 ), ( 352, 176, 92 ), ( 352, 220, 69 ), ( 352, 264, 46 ), ( 352, 308, 23 ),

( 396, 0, 207 ), ( 396, 44, 184 ), ( 396, 88, 161 ), ( 396, 132, 138 ), ( 396, 176, 115 ), ( 396, 220, 92 ), ( 396, 264, 69 ), ( 396, 308, 46 ), ( 396, 352, 23 ),

( 440, 0, 230 ), ( 440, 44, 207 ), ( 440, 88, 184 ), ( 440, 132, 161 ), ( 440, 176, 138 ), ( 440, 220, 115 ), ( 440, 264, 92 ), ( 440, 308, 69 ), ( 440, 352, 46 ), ( 440, 396, 23 ),

( 484, 0, 253 ), ( 484, 44, 230 ), ( 484, 88, 207 ), ( 484, 132, 184 ), ( 484, 176, 161 ), ( 484, 220, 138 ), ( 484, 264, 115 ), ( 484, 308, 92 ), ( 484, 352, 69 ), ( 484, 396, 46 ), ( 484, 440, 23 ),

( 528, 0, 276 ), ( 528, 44, 253 ), ( 528, 88, 230 ), ( 528, 132, 207 ), ( 528, 176, 184 ), ( 528, 220, 161 ), ( 528, 264, 138 ), ( 528, 308, 115 ), ( 528, 352, 92 ), ( 528, 396, 69 ), ( 528, 440, 46 ), ( 528, 484, 23 ),

( 572, 0, 299 ), ( 572, 44, 276 ), ( 572, 88, 253 ), ( 572, 132, 230 ), ( 572, 176, 207 ), ( 572, 220, 184 ), ( 572, 264, 161 ), ( 572, 308, 138 ), ( 572, 352, 115 ), ( 572, 396, 92 ), ( 572, 440, 69 ), ( 572, 484, 46 ), ( 572, 528, 23 ),

( 616, 0, 322 ), ( 616, 44, 299 ), ( 616, 88, 276 ), ( 616, 132, 253 ), ( 616, 176, 230 ), ( 616, 220, 207 ), ( 616, 264, 184 ), ( 616, 308, 161 ), ( 616, 352, 138 ), ( 616, 396, 115 ), ( 616, 440, 92 ), ( 616, 484, 69 ), ( 616, 528, 46 ), ( 616, 572, 23 ),

...

}

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)