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

( 41, 0, 14 ),

( 82, 0, 28 ), ( 82, 41, 14 ),

( 123, 0, 42 ), ( 123, 41, 28 ), ( 123, 82, 14 ),

( 164, 0, 56 ), ( 164, 41, 42 ), ( 164, 82, 28 ), ( 164, 123, 14 ),

( 205, 0, 70 ), ( 205, 41, 56 ), ( 205, 82, 42 ), ( 205, 123, 28 ), ( 205, 164, 14 ),

( 246, 0, 84 ), ( 246, 41, 70 ), ( 246, 82, 56 ), ( 246, 123, 42 ), ( 246, 164, 28 ), ( 246, 205, 14 ),

( 287, 0, 98 ), ( 287, 41, 84 ), ( 287, 82, 70 ), ( 287, 123, 56 ), ( 287, 164, 42 ), ( 287, 205, 28 ), ( 287, 246, 14 ),

( 328, 0, 112 ), ( 328, 41, 98 ), ( 328, 82, 84 ), ( 328, 123, 70 ), ( 328, 164, 56 ), ( 328, 205, 42 ), ( 328, 246, 28 ), ( 328, 287, 14 ),

( 369, 0, 126 ), ( 369, 41, 112 ), ( 369, 82, 98 ), ( 369, 123, 84 ), ( 369, 164, 70 ), ( 369, 205, 56 ), ( 369, 246, 42 ), ( 369, 287, 28 ), ( 369, 328, 14 ),

( 410, 0, 140 ), ( 410, 41, 126 ), ( 410, 82, 112 ), ( 410, 123, 98 ), ( 410, 164, 84 ), ( 410, 205, 70 ), ( 410, 246, 56 ), ( 410, 287, 42 ), ( 410, 328, 28 ), ( 410, 369, 14 ),

( 451, 0, 154 ), ( 451, 41, 140 ), ( 451, 82, 126 ), ( 451, 123, 112 ), ( 451, 164, 98 ), ( 451, 205, 84 ), ( 451, 246, 70 ), ( 451, 287, 56 ), ( 451, 328, 42 ), ( 451, 369, 28 ), ( 451, 410, 14 ),

( 492, 0, 168 ), ( 492, 41, 154 ), ( 492, 82, 140 ), ( 492, 123, 126 ), ( 492, 164, 112 ), ( 492, 205, 98 ), ( 492, 246, 84 ), ( 492, 287, 70 ), ( 492, 328, 56 ), ( 492, 369, 42 ), ( 492, 410, 28 ), ( 492, 451, 14 ),

( 533, 0, 182 ), ( 533, 41, 168 ), ( 533, 82, 154 ), ( 533, 123, 140 ), ( 533, 164, 126 ), ( 533, 205, 112 ), ( 533, 246, 98 ), ( 533, 287, 84 ), ( 533, 328, 70 ), ( 533, 369, 56 ), ( 533, 410, 42 ), ( 533, 451, 28 ), ( 533, 492, 14 ),

( 574, 0, 196 ), ( 574, 41, 182 ), ( 574, 82, 168 ), ( 574, 123, 154 ), ( 574, 164, 140 ), ( 574, 205, 126 ), ( 574, 246, 112 ), ( 574, 287, 98 ), ( 574, 328, 84 ), ( 574, 369, 70 ), ( 574, 410, 56 ), ( 574, 451, 42 ), ( 574, 492, 28 ), ( 574, 533, 14 ),

...

}

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)