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

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

( 42, 0, 19 ),

( 84, 0, 38 ), ( 84, 42, 19 ),

( 126, 0, 57 ), ( 126, 42, 38 ), ( 126, 84, 19 ),

( 168, 0, 76 ), ( 168, 42, 57 ), ( 168, 84, 38 ), ( 168, 126, 19 ),

( 210, 0, 95 ), ( 210, 42, 76 ), ( 210, 84, 57 ), ( 210, 126, 38 ), ( 210, 168, 19 ),

( 252, 0, 114 ), ( 252, 42, 95 ), ( 252, 84, 76 ), ( 252, 126, 57 ), ( 252, 168, 38 ), ( 252, 210, 19 ),

( 294, 0, 133 ), ( 294, 42, 114 ), ( 294, 84, 95 ), ( 294, 126, 76 ), ( 294, 168, 57 ), ( 294, 210, 38 ), ( 294, 252, 19 ),

( 336, 0, 152 ), ( 336, 42, 133 ), ( 336, 84, 114 ), ( 336, 126, 95 ), ( 336, 168, 76 ), ( 336, 210, 57 ), ( 336, 252, 38 ), ( 336, 294, 19 ),

( 378, 0, 171 ), ( 378, 42, 152 ), ( 378, 84, 133 ), ( 378, 126, 114 ), ( 378, 168, 95 ), ( 378, 210, 76 ), ( 378, 252, 57 ), ( 378, 294, 38 ), ( 378, 336, 19 ),

( 420, 0, 190 ), ( 420, 42, 171 ), ( 420, 84, 152 ), ( 420, 126, 133 ), ( 420, 168, 114 ), ( 420, 210, 95 ), ( 420, 252, 76 ), ( 420, 294, 57 ), ( 420, 336, 38 ), ( 420, 378, 19 ),

( 462, 0, 209 ), ( 462, 42, 190 ), ( 462, 84, 171 ), ( 462, 126, 152 ), ( 462, 168, 133 ), ( 462, 210, 114 ), ( 462, 252, 95 ), ( 462, 294, 76 ), ( 462, 336, 57 ), ( 462, 378, 38 ), ( 462, 420, 19 ),

( 504, 0, 228 ), ( 504, 42, 209 ), ( 504, 84, 190 ), ( 504, 126, 171 ), ( 504, 168, 152 ), ( 504, 210, 133 ), ( 504, 252, 114 ), ( 504, 294, 95 ), ( 504, 336, 76 ), ( 504, 378, 57 ), ( 504, 420, 38 ), ( 504, 462, 19 ),

( 546, 0, 247 ), ( 546, 42, 228 ), ( 546, 84, 209 ), ( 546, 126, 190 ), ( 546, 168, 171 ), ( 546, 210, 152 ), ( 546, 252, 133 ), ( 546, 294, 114 ), ( 546, 336, 95 ), ( 546, 378, 76 ), ( 546, 420, 57 ), ( 546, 462, 38 ), ( 546, 504, 19 ),

( 588, 0, 266 ), ( 588, 42, 247 ), ( 588, 84, 228 ), ( 588, 126, 209 ), ( 588, 168, 190 ), ( 588, 210, 171 ), ( 588, 252, 152 ), ( 588, 294, 133 ), ( 588, 336, 114 ), ( 588, 378, 95 ), ( 588, 420, 76 ), ( 588, 462, 57 ), ( 588, 504, 38 ), ( 588, 546, 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)