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

( 44, 0, 31 ),

( 88, 0, 62 ), ( 88, 44, 31 ),

( 132, 0, 93 ), ( 132, 44, 62 ), ( 132, 88, 31 ),

( 176, 0, 124 ), ( 176, 44, 93 ), ( 176, 88, 62 ), ( 176, 132, 31 ),

( 220, 0, 155 ), ( 220, 44, 124 ), ( 220, 88, 93 ), ( 220, 132, 62 ), ( 220, 176, 31 ),

( 264, 0, 186 ), ( 264, 44, 155 ), ( 264, 88, 124 ), ( 264, 132, 93 ), ( 264, 176, 62 ), ( 264, 220, 31 ),

( 308, 0, 217 ), ( 308, 44, 186 ), ( 308, 88, 155 ), ( 308, 132, 124 ), ( 308, 176, 93 ), ( 308, 220, 62 ), ( 308, 264, 31 ),

( 352, 0, 248 ), ( 352, 44, 217 ), ( 352, 88, 186 ), ( 352, 132, 155 ), ( 352, 176, 124 ), ( 352, 220, 93 ), ( 352, 264, 62 ), ( 352, 308, 31 ),

( 396, 0, 279 ), ( 396, 44, 248 ), ( 396, 88, 217 ), ( 396, 132, 186 ), ( 396, 176, 155 ), ( 396, 220, 124 ), ( 396, 264, 93 ), ( 396, 308, 62 ), ( 396, 352, 31 ),

( 440, 0, 310 ), ( 440, 44, 279 ), ( 440, 88, 248 ), ( 440, 132, 217 ), ( 440, 176, 186 ), ( 440, 220, 155 ), ( 440, 264, 124 ), ( 440, 308, 93 ), ( 440, 352, 62 ), ( 440, 396, 31 ),

( 484, 0, 341 ), ( 484, 44, 310 ), ( 484, 88, 279 ), ( 484, 132, 248 ), ( 484, 176, 217 ), ( 484, 220, 186 ), ( 484, 264, 155 ), ( 484, 308, 124 ), ( 484, 352, 93 ), ( 484, 396, 62 ), ( 484, 440, 31 ),

( 528, 0, 372 ), ( 528, 44, 341 ), ( 528, 88, 310 ), ( 528, 132, 279 ), ( 528, 176, 248 ), ( 528, 220, 217 ), ( 528, 264, 186 ), ( 528, 308, 155 ), ( 528, 352, 124 ), ( 528, 396, 93 ), ( 528, 440, 62 ), ( 528, 484, 31 ),

( 572, 0, 403 ), ( 572, 44, 372 ), ( 572, 88, 341 ), ( 572, 132, 310 ), ( 572, 176, 279 ), ( 572, 220, 248 ), ( 572, 264, 217 ), ( 572, 308, 186 ), ( 572, 352, 155 ), ( 572, 396, 124 ), ( 572, 440, 93 ), ( 572, 484, 62 ), ( 572, 528, 31 ),

( 616, 0, 434 ), ( 616, 44, 403 ), ( 616, 88, 372 ), ( 616, 132, 341 ), ( 616, 176, 310 ), ( 616, 220, 279 ), ( 616, 264, 248 ), ( 616, 308, 217 ), ( 616, 352, 186 ), ( 616, 396, 155 ), ( 616, 440, 124 ), ( 616, 484, 93 ), ( 616, 528, 62 ), ( 616, 572, 31 ),

...

}

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)