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

( 46, 0, 13 ),

( 92, 0, 26 ), ( 92, 46, 13 ),

( 138, 0, 39 ), ( 138, 46, 26 ), ( 138, 92, 13 ),

( 184, 0, 52 ), ( 184, 46, 39 ), ( 184, 92, 26 ), ( 184, 138, 13 ),

( 230, 0, 65 ), ( 230, 46, 52 ), ( 230, 92, 39 ), ( 230, 138, 26 ), ( 230, 184, 13 ),

( 276, 0, 78 ), ( 276, 46, 65 ), ( 276, 92, 52 ), ( 276, 138, 39 ), ( 276, 184, 26 ), ( 276, 230, 13 ),

( 322, 0, 91 ), ( 322, 46, 78 ), ( 322, 92, 65 ), ( 322, 138, 52 ), ( 322, 184, 39 ), ( 322, 230, 26 ), ( 322, 276, 13 ),

( 368, 0, 104 ), ( 368, 46, 91 ), ( 368, 92, 78 ), ( 368, 138, 65 ), ( 368, 184, 52 ), ( 368, 230, 39 ), ( 368, 276, 26 ), ( 368, 322, 13 ),

( 414, 0, 117 ), ( 414, 46, 104 ), ( 414, 92, 91 ), ( 414, 138, 78 ), ( 414, 184, 65 ), ( 414, 230, 52 ), ( 414, 276, 39 ), ( 414, 322, 26 ), ( 414, 368, 13 ),

( 460, 0, 130 ), ( 460, 46, 117 ), ( 460, 92, 104 ), ( 460, 138, 91 ), ( 460, 184, 78 ), ( 460, 230, 65 ), ( 460, 276, 52 ), ( 460, 322, 39 ), ( 460, 368, 26 ), ( 460, 414, 13 ),

( 506, 0, 143 ), ( 506, 46, 130 ), ( 506, 92, 117 ), ( 506, 138, 104 ), ( 506, 184, 91 ), ( 506, 230, 78 ), ( 506, 276, 65 ), ( 506, 322, 52 ), ( 506, 368, 39 ), ( 506, 414, 26 ), ( 506, 460, 13 ),

( 552, 0, 156 ), ( 552, 46, 143 ), ( 552, 92, 130 ), ( 552, 138, 117 ), ( 552, 184, 104 ), ( 552, 230, 91 ), ( 552, 276, 78 ), ( 552, 322, 65 ), ( 552, 368, 52 ), ( 552, 414, 39 ), ( 552, 460, 26 ), ( 552, 506, 13 ),

( 598, 0, 169 ), ( 598, 46, 156 ), ( 598, 92, 143 ), ( 598, 138, 130 ), ( 598, 184, 117 ), ( 598, 230, 104 ), ( 598, 276, 91 ), ( 598, 322, 78 ), ( 598, 368, 65 ), ( 598, 414, 52 ), ( 598, 460, 39 ), ( 598, 506, 26 ), ( 598, 552, 13 ),

( 644, 0, 182 ), ( 644, 46, 169 ), ( 644, 92, 156 ), ( 644, 138, 143 ), ( 644, 184, 130 ), ( 644, 230, 117 ), ( 644, 276, 104 ), ( 644, 322, 91 ), ( 644, 368, 78 ), ( 644, 414, 65 ), ( 644, 460, 52 ), ( 644, 506, 39 ), ( 644, 552, 26 ), ( 644, 598, 13 ),

...

}

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)