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

( 41, 0, 2 ),

( 82, 0, 4 ), ( 82, 41, 2 ),

( 123, 0, 6 ), ( 123, 41, 4 ), ( 123, 82, 2 ),

( 164, 0, 8 ), ( 164, 41, 6 ), ( 164, 82, 4 ), ( 164, 123, 2 ),

( 205, 0, 10 ), ( 205, 41, 8 ), ( 205, 82, 6 ), ( 205, 123, 4 ), ( 205, 164, 2 ),

( 246, 0, 12 ), ( 246, 41, 10 ), ( 246, 82, 8 ), ( 246, 123, 6 ), ( 246, 164, 4 ), ( 246, 205, 2 ),

( 287, 0, 14 ), ( 287, 41, 12 ), ( 287, 82, 10 ), ( 287, 123, 8 ), ( 287, 164, 6 ), ( 287, 205, 4 ), ( 287, 246, 2 ),

( 328, 0, 16 ), ( 328, 41, 14 ), ( 328, 82, 12 ), ( 328, 123, 10 ), ( 328, 164, 8 ), ( 328, 205, 6 ), ( 328, 246, 4 ), ( 328, 287, 2 ),

( 369, 0, 18 ), ( 369, 41, 16 ), ( 369, 82, 14 ), ( 369, 123, 12 ), ( 369, 164, 10 ), ( 369, 205, 8 ), ( 369, 246, 6 ), ( 369, 287, 4 ), ( 369, 328, 2 ),

( 410, 0, 20 ), ( 410, 41, 18 ), ( 410, 82, 16 ), ( 410, 123, 14 ), ( 410, 164, 12 ), ( 410, 205, 10 ), ( 410, 246, 8 ), ( 410, 287, 6 ), ( 410, 328, 4 ), ( 410, 369, 2 ),

( 451, 0, 22 ), ( 451, 41, 20 ), ( 451, 82, 18 ), ( 451, 123, 16 ), ( 451, 164, 14 ), ( 451, 205, 12 ), ( 451, 246, 10 ), ( 451, 287, 8 ), ( 451, 328, 6 ), ( 451, 369, 4 ), ( 451, 410, 2 ),

( 492, 0, 24 ), ( 492, 41, 22 ), ( 492, 82, 20 ), ( 492, 123, 18 ), ( 492, 164, 16 ), ( 492, 205, 14 ), ( 492, 246, 12 ), ( 492, 287, 10 ), ( 492, 328, 8 ), ( 492, 369, 6 ), ( 492, 410, 4 ), ( 492, 451, 2 ),

( 533, 0, 26 ), ( 533, 41, 24 ), ( 533, 82, 22 ), ( 533, 123, 20 ), ( 533, 164, 18 ), ( 533, 205, 16 ), ( 533, 246, 14 ), ( 533, 287, 12 ), ( 533, 328, 10 ), ( 533, 369, 8 ), ( 533, 410, 6 ), ( 533, 451, 4 ), ( 533, 492, 2 ),

( 574, 0, 28 ), ( 574, 41, 26 ), ( 574, 82, 24 ), ( 574, 123, 22 ), ( 574, 164, 20 ), ( 574, 205, 18 ), ( 574, 246, 16 ), ( 574, 287, 14 ), ( 574, 328, 12 ), ( 574, 369, 10 ), ( 574, 410, 8 ), ( 574, 451, 6 ), ( 574, 492, 4 ), ( 574, 533, 2 ),

...

}

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)