The rational number 41/27 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.

41/27 = (41-0)/27 = {

( 41, 0, 27 ),

( 82, 0, 54 ), ( 82, 41, 27 ),

( 123, 0, 81 ), ( 123, 41, 54 ), ( 123, 82, 27 ),

( 164, 0, 108 ), ( 164, 41, 81 ), ( 164, 82, 54 ), ( 164, 123, 27 ),

( 205, 0, 135 ), ( 205, 41, 108 ), ( 205, 82, 81 ), ( 205, 123, 54 ), ( 205, 164, 27 ),

( 246, 0, 162 ), ( 246, 41, 135 ), ( 246, 82, 108 ), ( 246, 123, 81 ), ( 246, 164, 54 ), ( 246, 205, 27 ),

( 287, 0, 189 ), ( 287, 41, 162 ), ( 287, 82, 135 ), ( 287, 123, 108 ), ( 287, 164, 81 ), ( 287, 205, 54 ), ( 287, 246, 27 ),

( 328, 0, 216 ), ( 328, 41, 189 ), ( 328, 82, 162 ), ( 328, 123, 135 ), ( 328, 164, 108 ), ( 328, 205, 81 ), ( 328, 246, 54 ), ( 328, 287, 27 ),

( 369, 0, 243 ), ( 369, 41, 216 ), ( 369, 82, 189 ), ( 369, 123, 162 ), ( 369, 164, 135 ), ( 369, 205, 108 ), ( 369, 246, 81 ), ( 369, 287, 54 ), ( 369, 328, 27 ),

( 410, 0, 270 ), ( 410, 41, 243 ), ( 410, 82, 216 ), ( 410, 123, 189 ), ( 410, 164, 162 ), ( 410, 205, 135 ), ( 410, 246, 108 ), ( 410, 287, 81 ), ( 410, 328, 54 ), ( 410, 369, 27 ),

( 451, 0, 297 ), ( 451, 41, 270 ), ( 451, 82, 243 ), ( 451, 123, 216 ), ( 451, 164, 189 ), ( 451, 205, 162 ), ( 451, 246, 135 ), ( 451, 287, 108 ), ( 451, 328, 81 ), ( 451, 369, 54 ), ( 451, 410, 27 ),

( 492, 0, 324 ), ( 492, 41, 297 ), ( 492, 82, 270 ), ( 492, 123, 243 ), ( 492, 164, 216 ), ( 492, 205, 189 ), ( 492, 246, 162 ), ( 492, 287, 135 ), ( 492, 328, 108 ), ( 492, 369, 81 ), ( 492, 410, 54 ), ( 492, 451, 27 ),

( 533, 0, 351 ), ( 533, 41, 324 ), ( 533, 82, 297 ), ( 533, 123, 270 ), ( 533, 164, 243 ), ( 533, 205, 216 ), ( 533, 246, 189 ), ( 533, 287, 162 ), ( 533, 328, 135 ), ( 533, 369, 108 ), ( 533, 410, 81 ), ( 533, 451, 54 ), ( 533, 492, 27 ),

( 574, 0, 378 ), ( 574, 41, 351 ), ( 574, 82, 324 ), ( 574, 123, 297 ), ( 574, 164, 270 ), ( 574, 205, 243 ), ( 574, 246, 216 ), ( 574, 287, 189 ), ( 574, 328, 162 ), ( 574, 369, 135 ), ( 574, 410, 108 ), ( 574, 451, 81 ), ( 574, 492, 54 ), ( 574, 533, 27 ),

...

}

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)