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

( 41, 0, 3 ),

( 82, 0, 6 ), ( 82, 41, 3 ),

( 123, 0, 9 ), ( 123, 41, 6 ), ( 123, 82, 3 ),

( 164, 0, 12 ), ( 164, 41, 9 ), ( 164, 82, 6 ), ( 164, 123, 3 ),

( 205, 0, 15 ), ( 205, 41, 12 ), ( 205, 82, 9 ), ( 205, 123, 6 ), ( 205, 164, 3 ),

( 246, 0, 18 ), ( 246, 41, 15 ), ( 246, 82, 12 ), ( 246, 123, 9 ), ( 246, 164, 6 ), ( 246, 205, 3 ),

( 287, 0, 21 ), ( 287, 41, 18 ), ( 287, 82, 15 ), ( 287, 123, 12 ), ( 287, 164, 9 ), ( 287, 205, 6 ), ( 287, 246, 3 ),

( 328, 0, 24 ), ( 328, 41, 21 ), ( 328, 82, 18 ), ( 328, 123, 15 ), ( 328, 164, 12 ), ( 328, 205, 9 ), ( 328, 246, 6 ), ( 328, 287, 3 ),

( 369, 0, 27 ), ( 369, 41, 24 ), ( 369, 82, 21 ), ( 369, 123, 18 ), ( 369, 164, 15 ), ( 369, 205, 12 ), ( 369, 246, 9 ), ( 369, 287, 6 ), ( 369, 328, 3 ),

( 410, 0, 30 ), ( 410, 41, 27 ), ( 410, 82, 24 ), ( 410, 123, 21 ), ( 410, 164, 18 ), ( 410, 205, 15 ), ( 410, 246, 12 ), ( 410, 287, 9 ), ( 410, 328, 6 ), ( 410, 369, 3 ),

( 451, 0, 33 ), ( 451, 41, 30 ), ( 451, 82, 27 ), ( 451, 123, 24 ), ( 451, 164, 21 ), ( 451, 205, 18 ), ( 451, 246, 15 ), ( 451, 287, 12 ), ( 451, 328, 9 ), ( 451, 369, 6 ), ( 451, 410, 3 ),

( 492, 0, 36 ), ( 492, 41, 33 ), ( 492, 82, 30 ), ( 492, 123, 27 ), ( 492, 164, 24 ), ( 492, 205, 21 ), ( 492, 246, 18 ), ( 492, 287, 15 ), ( 492, 328, 12 ), ( 492, 369, 9 ), ( 492, 410, 6 ), ( 492, 451, 3 ),

( 533, 0, 39 ), ( 533, 41, 36 ), ( 533, 82, 33 ), ( 533, 123, 30 ), ( 533, 164, 27 ), ( 533, 205, 24 ), ( 533, 246, 21 ), ( 533, 287, 18 ), ( 533, 328, 15 ), ( 533, 369, 12 ), ( 533, 410, 9 ), ( 533, 451, 6 ), ( 533, 492, 3 ),

( 574, 0, 42 ), ( 574, 41, 39 ), ( 574, 82, 36 ), ( 574, 123, 33 ), ( 574, 164, 30 ), ( 574, 205, 27 ), ( 574, 246, 24 ), ( 574, 287, 21 ), ( 574, 328, 18 ), ( 574, 369, 15 ), ( 574, 410, 12 ), ( 574, 451, 9 ), ( 574, 492, 6 ), ( 574, 533, 3 ),

...

}

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)