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

25/13 = (25-0)/13 = {

( 25, 0, 13 ),

( 50, 0, 26 ), ( 50, 25, 13 ),

( 75, 0, 39 ), ( 75, 25, 26 ), ( 75, 50, 13 ),

( 100, 0, 52 ), ( 100, 25, 39 ), ( 100, 50, 26 ), ( 100, 75, 13 ),

( 125, 0, 65 ), ( 125, 25, 52 ), ( 125, 50, 39 ), ( 125, 75, 26 ), ( 125, 100, 13 ),

( 150, 0, 78 ), ( 150, 25, 65 ), ( 150, 50, 52 ), ( 150, 75, 39 ), ( 150, 100, 26 ), ( 150, 125, 13 ),

( 175, 0, 91 ), ( 175, 25, 78 ), ( 175, 50, 65 ), ( 175, 75, 52 ), ( 175, 100, 39 ), ( 175, 125, 26 ), ( 175, 150, 13 ),

( 200, 0, 104 ), ( 200, 25, 91 ), ( 200, 50, 78 ), ( 200, 75, 65 ), ( 200, 100, 52 ), ( 200, 125, 39 ), ( 200, 150, 26 ), ( 200, 175, 13 ),

( 225, 0, 117 ), ( 225, 25, 104 ), ( 225, 50, 91 ), ( 225, 75, 78 ), ( 225, 100, 65 ), ( 225, 125, 52 ), ( 225, 150, 39 ), ( 225, 175, 26 ), ( 225, 200, 13 ),

( 250, 0, 130 ), ( 250, 25, 117 ), ( 250, 50, 104 ), ( 250, 75, 91 ), ( 250, 100, 78 ), ( 250, 125, 65 ), ( 250, 150, 52 ), ( 250, 175, 39 ), ( 250, 200, 26 ), ( 250, 225, 13 ),

( 275, 0, 143 ), ( 275, 25, 130 ), ( 275, 50, 117 ), ( 275, 75, 104 ), ( 275, 100, 91 ), ( 275, 125, 78 ), ( 275, 150, 65 ), ( 275, 175, 52 ), ( 275, 200, 39 ), ( 275, 225, 26 ), ( 275, 250, 13 ),

( 300, 0, 156 ), ( 300, 25, 143 ), ( 300, 50, 130 ), ( 300, 75, 117 ), ( 300, 100, 104 ), ( 300, 125, 91 ), ( 300, 150, 78 ), ( 300, 175, 65 ), ( 300, 200, 52 ), ( 300, 225, 39 ), ( 300, 250, 26 ), ( 300, 275, 13 ),

( 325, 0, 169 ), ( 325, 25, 156 ), ( 325, 50, 143 ), ( 325, 75, 130 ), ( 325, 100, 117 ), ( 325, 125, 104 ), ( 325, 150, 91 ), ( 325, 175, 78 ), ( 325, 200, 65 ), ( 325, 225, 52 ), ( 325, 250, 39 ), ( 325, 275, 26 ), ( 325, 300, 13 ),

( 350, 0, 182 ), ( 350, 25, 169 ), ( 350, 50, 156 ), ( 350, 75, 143 ), ( 350, 100, 130 ), ( 350, 125, 117 ), ( 350, 150, 104 ), ( 350, 175, 91 ), ( 350, 200, 78 ), ( 350, 225, 65 ), ( 350, 250, 52 ), ( 350, 275, 39 ), ( 350, 300, 26 ), ( 350, 325, 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)