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

( 46, 0, 5 ),

( 92, 0, 10 ), ( 92, 46, 5 ),

( 138, 0, 15 ), ( 138, 46, 10 ), ( 138, 92, 5 ),

( 184, 0, 20 ), ( 184, 46, 15 ), ( 184, 92, 10 ), ( 184, 138, 5 ),

( 230, 0, 25 ), ( 230, 46, 20 ), ( 230, 92, 15 ), ( 230, 138, 10 ), ( 230, 184, 5 ),

( 276, 0, 30 ), ( 276, 46, 25 ), ( 276, 92, 20 ), ( 276, 138, 15 ), ( 276, 184, 10 ), ( 276, 230, 5 ),

( 322, 0, 35 ), ( 322, 46, 30 ), ( 322, 92, 25 ), ( 322, 138, 20 ), ( 322, 184, 15 ), ( 322, 230, 10 ), ( 322, 276, 5 ),

( 368, 0, 40 ), ( 368, 46, 35 ), ( 368, 92, 30 ), ( 368, 138, 25 ), ( 368, 184, 20 ), ( 368, 230, 15 ), ( 368, 276, 10 ), ( 368, 322, 5 ),

( 414, 0, 45 ), ( 414, 46, 40 ), ( 414, 92, 35 ), ( 414, 138, 30 ), ( 414, 184, 25 ), ( 414, 230, 20 ), ( 414, 276, 15 ), ( 414, 322, 10 ), ( 414, 368, 5 ),

( 460, 0, 50 ), ( 460, 46, 45 ), ( 460, 92, 40 ), ( 460, 138, 35 ), ( 460, 184, 30 ), ( 460, 230, 25 ), ( 460, 276, 20 ), ( 460, 322, 15 ), ( 460, 368, 10 ), ( 460, 414, 5 ),

( 506, 0, 55 ), ( 506, 46, 50 ), ( 506, 92, 45 ), ( 506, 138, 40 ), ( 506, 184, 35 ), ( 506, 230, 30 ), ( 506, 276, 25 ), ( 506, 322, 20 ), ( 506, 368, 15 ), ( 506, 414, 10 ), ( 506, 460, 5 ),

( 552, 0, 60 ), ( 552, 46, 55 ), ( 552, 92, 50 ), ( 552, 138, 45 ), ( 552, 184, 40 ), ( 552, 230, 35 ), ( 552, 276, 30 ), ( 552, 322, 25 ), ( 552, 368, 20 ), ( 552, 414, 15 ), ( 552, 460, 10 ), ( 552, 506, 5 ),

( 598, 0, 65 ), ( 598, 46, 60 ), ( 598, 92, 55 ), ( 598, 138, 50 ), ( 598, 184, 45 ), ( 598, 230, 40 ), ( 598, 276, 35 ), ( 598, 322, 30 ), ( 598, 368, 25 ), ( 598, 414, 20 ), ( 598, 460, 15 ), ( 598, 506, 10 ), ( 598, 552, 5 ),

( 644, 0, 70 ), ( 644, 46, 65 ), ( 644, 92, 60 ), ( 644, 138, 55 ), ( 644, 184, 50 ), ( 644, 230, 45 ), ( 644, 276, 40 ), ( 644, 322, 35 ), ( 644, 368, 30 ), ( 644, 414, 25 ), ( 644, 460, 20 ), ( 644, 506, 15 ), ( 644, 552, 10 ), ( 644, 598, 5 ),

...

}

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)