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

( 46, 0, 25 ),

( 92, 0, 50 ), ( 92, 46, 25 ),

( 138, 0, 75 ), ( 138, 46, 50 ), ( 138, 92, 25 ),

( 184, 0, 100 ), ( 184, 46, 75 ), ( 184, 92, 50 ), ( 184, 138, 25 ),

( 230, 0, 125 ), ( 230, 46, 100 ), ( 230, 92, 75 ), ( 230, 138, 50 ), ( 230, 184, 25 ),

( 276, 0, 150 ), ( 276, 46, 125 ), ( 276, 92, 100 ), ( 276, 138, 75 ), ( 276, 184, 50 ), ( 276, 230, 25 ),

( 322, 0, 175 ), ( 322, 46, 150 ), ( 322, 92, 125 ), ( 322, 138, 100 ), ( 322, 184, 75 ), ( 322, 230, 50 ), ( 322, 276, 25 ),

( 368, 0, 200 ), ( 368, 46, 175 ), ( 368, 92, 150 ), ( 368, 138, 125 ), ( 368, 184, 100 ), ( 368, 230, 75 ), ( 368, 276, 50 ), ( 368, 322, 25 ),

( 414, 0, 225 ), ( 414, 46, 200 ), ( 414, 92, 175 ), ( 414, 138, 150 ), ( 414, 184, 125 ), ( 414, 230, 100 ), ( 414, 276, 75 ), ( 414, 322, 50 ), ( 414, 368, 25 ),

( 460, 0, 250 ), ( 460, 46, 225 ), ( 460, 92, 200 ), ( 460, 138, 175 ), ( 460, 184, 150 ), ( 460, 230, 125 ), ( 460, 276, 100 ), ( 460, 322, 75 ), ( 460, 368, 50 ), ( 460, 414, 25 ),

( 506, 0, 275 ), ( 506, 46, 250 ), ( 506, 92, 225 ), ( 506, 138, 200 ), ( 506, 184, 175 ), ( 506, 230, 150 ), ( 506, 276, 125 ), ( 506, 322, 100 ), ( 506, 368, 75 ), ( 506, 414, 50 ), ( 506, 460, 25 ),

( 552, 0, 300 ), ( 552, 46, 275 ), ( 552, 92, 250 ), ( 552, 138, 225 ), ( 552, 184, 200 ), ( 552, 230, 175 ), ( 552, 276, 150 ), ( 552, 322, 125 ), ( 552, 368, 100 ), ( 552, 414, 75 ), ( 552, 460, 50 ), ( 552, 506, 25 ),

( 598, 0, 325 ), ( 598, 46, 300 ), ( 598, 92, 275 ), ( 598, 138, 250 ), ( 598, 184, 225 ), ( 598, 230, 200 ), ( 598, 276, 175 ), ( 598, 322, 150 ), ( 598, 368, 125 ), ( 598, 414, 100 ), ( 598, 460, 75 ), ( 598, 506, 50 ), ( 598, 552, 25 ),

( 644, 0, 350 ), ( 644, 46, 325 ), ( 644, 92, 300 ), ( 644, 138, 275 ), ( 644, 184, 250 ), ( 644, 230, 225 ), ( 644, 276, 200 ), ( 644, 322, 175 ), ( 644, 368, 150 ), ( 644, 414, 125 ), ( 644, 460, 100 ), ( 644, 506, 75 ), ( 644, 552, 50 ), ( 644, 598, 25 ),

...

}

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)