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

( 41, 0, 19 ),

( 82, 0, 38 ), ( 82, 41, 19 ),

( 123, 0, 57 ), ( 123, 41, 38 ), ( 123, 82, 19 ),

( 164, 0, 76 ), ( 164, 41, 57 ), ( 164, 82, 38 ), ( 164, 123, 19 ),

( 205, 0, 95 ), ( 205, 41, 76 ), ( 205, 82, 57 ), ( 205, 123, 38 ), ( 205, 164, 19 ),

( 246, 0, 114 ), ( 246, 41, 95 ), ( 246, 82, 76 ), ( 246, 123, 57 ), ( 246, 164, 38 ), ( 246, 205, 19 ),

( 287, 0, 133 ), ( 287, 41, 114 ), ( 287, 82, 95 ), ( 287, 123, 76 ), ( 287, 164, 57 ), ( 287, 205, 38 ), ( 287, 246, 19 ),

( 328, 0, 152 ), ( 328, 41, 133 ), ( 328, 82, 114 ), ( 328, 123, 95 ), ( 328, 164, 76 ), ( 328, 205, 57 ), ( 328, 246, 38 ), ( 328, 287, 19 ),

( 369, 0, 171 ), ( 369, 41, 152 ), ( 369, 82, 133 ), ( 369, 123, 114 ), ( 369, 164, 95 ), ( 369, 205, 76 ), ( 369, 246, 57 ), ( 369, 287, 38 ), ( 369, 328, 19 ),

( 410, 0, 190 ), ( 410, 41, 171 ), ( 410, 82, 152 ), ( 410, 123, 133 ), ( 410, 164, 114 ), ( 410, 205, 95 ), ( 410, 246, 76 ), ( 410, 287, 57 ), ( 410, 328, 38 ), ( 410, 369, 19 ),

( 451, 0, 209 ), ( 451, 41, 190 ), ( 451, 82, 171 ), ( 451, 123, 152 ), ( 451, 164, 133 ), ( 451, 205, 114 ), ( 451, 246, 95 ), ( 451, 287, 76 ), ( 451, 328, 57 ), ( 451, 369, 38 ), ( 451, 410, 19 ),

( 492, 0, 228 ), ( 492, 41, 209 ), ( 492, 82, 190 ), ( 492, 123, 171 ), ( 492, 164, 152 ), ( 492, 205, 133 ), ( 492, 246, 114 ), ( 492, 287, 95 ), ( 492, 328, 76 ), ( 492, 369, 57 ), ( 492, 410, 38 ), ( 492, 451, 19 ),

( 533, 0, 247 ), ( 533, 41, 228 ), ( 533, 82, 209 ), ( 533, 123, 190 ), ( 533, 164, 171 ), ( 533, 205, 152 ), ( 533, 246, 133 ), ( 533, 287, 114 ), ( 533, 328, 95 ), ( 533, 369, 76 ), ( 533, 410, 57 ), ( 533, 451, 38 ), ( 533, 492, 19 ),

( 574, 0, 266 ), ( 574, 41, 247 ), ( 574, 82, 228 ), ( 574, 123, 209 ), ( 574, 164, 190 ), ( 574, 205, 171 ), ( 574, 246, 152 ), ( 574, 287, 133 ), ( 574, 328, 114 ), ( 574, 369, 95 ), ( 574, 410, 76 ), ( 574, 451, 57 ), ( 574, 492, 38 ), ( 574, 533, 19 ),

...

}

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)