The rational number 46/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.

46/19 = (46-0)/19 = {

( 46, 0, 19 ),

( 92, 0, 38 ), ( 92, 46, 19 ),

( 138, 0, 57 ), ( 138, 46, 38 ), ( 138, 92, 19 ),

( 184, 0, 76 ), ( 184, 46, 57 ), ( 184, 92, 38 ), ( 184, 138, 19 ),

( 230, 0, 95 ), ( 230, 46, 76 ), ( 230, 92, 57 ), ( 230, 138, 38 ), ( 230, 184, 19 ),

( 276, 0, 114 ), ( 276, 46, 95 ), ( 276, 92, 76 ), ( 276, 138, 57 ), ( 276, 184, 38 ), ( 276, 230, 19 ),

( 322, 0, 133 ), ( 322, 46, 114 ), ( 322, 92, 95 ), ( 322, 138, 76 ), ( 322, 184, 57 ), ( 322, 230, 38 ), ( 322, 276, 19 ),

( 368, 0, 152 ), ( 368, 46, 133 ), ( 368, 92, 114 ), ( 368, 138, 95 ), ( 368, 184, 76 ), ( 368, 230, 57 ), ( 368, 276, 38 ), ( 368, 322, 19 ),

( 414, 0, 171 ), ( 414, 46, 152 ), ( 414, 92, 133 ), ( 414, 138, 114 ), ( 414, 184, 95 ), ( 414, 230, 76 ), ( 414, 276, 57 ), ( 414, 322, 38 ), ( 414, 368, 19 ),

( 460, 0, 190 ), ( 460, 46, 171 ), ( 460, 92, 152 ), ( 460, 138, 133 ), ( 460, 184, 114 ), ( 460, 230, 95 ), ( 460, 276, 76 ), ( 460, 322, 57 ), ( 460, 368, 38 ), ( 460, 414, 19 ),

( 506, 0, 209 ), ( 506, 46, 190 ), ( 506, 92, 171 ), ( 506, 138, 152 ), ( 506, 184, 133 ), ( 506, 230, 114 ), ( 506, 276, 95 ), ( 506, 322, 76 ), ( 506, 368, 57 ), ( 506, 414, 38 ), ( 506, 460, 19 ),

( 552, 0, 228 ), ( 552, 46, 209 ), ( 552, 92, 190 ), ( 552, 138, 171 ), ( 552, 184, 152 ), ( 552, 230, 133 ), ( 552, 276, 114 ), ( 552, 322, 95 ), ( 552, 368, 76 ), ( 552, 414, 57 ), ( 552, 460, 38 ), ( 552, 506, 19 ),

( 598, 0, 247 ), ( 598, 46, 228 ), ( 598, 92, 209 ), ( 598, 138, 190 ), ( 598, 184, 171 ), ( 598, 230, 152 ), ( 598, 276, 133 ), ( 598, 322, 114 ), ( 598, 368, 95 ), ( 598, 414, 76 ), ( 598, 460, 57 ), ( 598, 506, 38 ), ( 598, 552, 19 ),

( 644, 0, 266 ), ( 644, 46, 247 ), ( 644, 92, 228 ), ( 644, 138, 209 ), ( 644, 184, 190 ), ( 644, 230, 171 ), ( 644, 276, 152 ), ( 644, 322, 133 ), ( 644, 368, 114 ), ( 644, 414, 95 ), ( 644, 460, 76 ), ( 644, 506, 57 ), ( 644, 552, 38 ), ( 644, 598, 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)