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

( 41, 0, 15 ),

( 82, 0, 30 ), ( 82, 41, 15 ),

( 123, 0, 45 ), ( 123, 41, 30 ), ( 123, 82, 15 ),

( 164, 0, 60 ), ( 164, 41, 45 ), ( 164, 82, 30 ), ( 164, 123, 15 ),

( 205, 0, 75 ), ( 205, 41, 60 ), ( 205, 82, 45 ), ( 205, 123, 30 ), ( 205, 164, 15 ),

( 246, 0, 90 ), ( 246, 41, 75 ), ( 246, 82, 60 ), ( 246, 123, 45 ), ( 246, 164, 30 ), ( 246, 205, 15 ),

( 287, 0, 105 ), ( 287, 41, 90 ), ( 287, 82, 75 ), ( 287, 123, 60 ), ( 287, 164, 45 ), ( 287, 205, 30 ), ( 287, 246, 15 ),

( 328, 0, 120 ), ( 328, 41, 105 ), ( 328, 82, 90 ), ( 328, 123, 75 ), ( 328, 164, 60 ), ( 328, 205, 45 ), ( 328, 246, 30 ), ( 328, 287, 15 ),

( 369, 0, 135 ), ( 369, 41, 120 ), ( 369, 82, 105 ), ( 369, 123, 90 ), ( 369, 164, 75 ), ( 369, 205, 60 ), ( 369, 246, 45 ), ( 369, 287, 30 ), ( 369, 328, 15 ),

( 410, 0, 150 ), ( 410, 41, 135 ), ( 410, 82, 120 ), ( 410, 123, 105 ), ( 410, 164, 90 ), ( 410, 205, 75 ), ( 410, 246, 60 ), ( 410, 287, 45 ), ( 410, 328, 30 ), ( 410, 369, 15 ),

( 451, 0, 165 ), ( 451, 41, 150 ), ( 451, 82, 135 ), ( 451, 123, 120 ), ( 451, 164, 105 ), ( 451, 205, 90 ), ( 451, 246, 75 ), ( 451, 287, 60 ), ( 451, 328, 45 ), ( 451, 369, 30 ), ( 451, 410, 15 ),

( 492, 0, 180 ), ( 492, 41, 165 ), ( 492, 82, 150 ), ( 492, 123, 135 ), ( 492, 164, 120 ), ( 492, 205, 105 ), ( 492, 246, 90 ), ( 492, 287, 75 ), ( 492, 328, 60 ), ( 492, 369, 45 ), ( 492, 410, 30 ), ( 492, 451, 15 ),

( 533, 0, 195 ), ( 533, 41, 180 ), ( 533, 82, 165 ), ( 533, 123, 150 ), ( 533, 164, 135 ), ( 533, 205, 120 ), ( 533, 246, 105 ), ( 533, 287, 90 ), ( 533, 328, 75 ), ( 533, 369, 60 ), ( 533, 410, 45 ), ( 533, 451, 30 ), ( 533, 492, 15 ),

( 574, 0, 210 ), ( 574, 41, 195 ), ( 574, 82, 180 ), ( 574, 123, 165 ), ( 574, 164, 150 ), ( 574, 205, 135 ), ( 574, 246, 120 ), ( 574, 287, 105 ), ( 574, 328, 90 ), ( 574, 369, 75 ), ( 574, 410, 60 ), ( 574, 451, 45 ), ( 574, 492, 30 ), ( 574, 533, 15 ),

...

}

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)