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

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

( 24, 0, 13 ),

( 48, 0, 26 ), ( 48, 24, 13 ),

( 72, 0, 39 ), ( 72, 24, 26 ), ( 72, 48, 13 ),

( 96, 0, 52 ), ( 96, 24, 39 ), ( 96, 48, 26 ), ( 96, 72, 13 ),

( 120, 0, 65 ), ( 120, 24, 52 ), ( 120, 48, 39 ), ( 120, 72, 26 ), ( 120, 96, 13 ),

( 144, 0, 78 ), ( 144, 24, 65 ), ( 144, 48, 52 ), ( 144, 72, 39 ), ( 144, 96, 26 ), ( 144, 120, 13 ),

( 168, 0, 91 ), ( 168, 24, 78 ), ( 168, 48, 65 ), ( 168, 72, 52 ), ( 168, 96, 39 ), ( 168, 120, 26 ), ( 168, 144, 13 ),

( 192, 0, 104 ), ( 192, 24, 91 ), ( 192, 48, 78 ), ( 192, 72, 65 ), ( 192, 96, 52 ), ( 192, 120, 39 ), ( 192, 144, 26 ), ( 192, 168, 13 ),

( 216, 0, 117 ), ( 216, 24, 104 ), ( 216, 48, 91 ), ( 216, 72, 78 ), ( 216, 96, 65 ), ( 216, 120, 52 ), ( 216, 144, 39 ), ( 216, 168, 26 ), ( 216, 192, 13 ),

( 240, 0, 130 ), ( 240, 24, 117 ), ( 240, 48, 104 ), ( 240, 72, 91 ), ( 240, 96, 78 ), ( 240, 120, 65 ), ( 240, 144, 52 ), ( 240, 168, 39 ), ( 240, 192, 26 ), ( 240, 216, 13 ),

( 264, 0, 143 ), ( 264, 24, 130 ), ( 264, 48, 117 ), ( 264, 72, 104 ), ( 264, 96, 91 ), ( 264, 120, 78 ), ( 264, 144, 65 ), ( 264, 168, 52 ), ( 264, 192, 39 ), ( 264, 216, 26 ), ( 264, 240, 13 ),

( 288, 0, 156 ), ( 288, 24, 143 ), ( 288, 48, 130 ), ( 288, 72, 117 ), ( 288, 96, 104 ), ( 288, 120, 91 ), ( 288, 144, 78 ), ( 288, 168, 65 ), ( 288, 192, 52 ), ( 288, 216, 39 ), ( 288, 240, 26 ), ( 288, 264, 13 ),

( 312, 0, 169 ), ( 312, 24, 156 ), ( 312, 48, 143 ), ( 312, 72, 130 ), ( 312, 96, 117 ), ( 312, 120, 104 ), ( 312, 144, 91 ), ( 312, 168, 78 ), ( 312, 192, 65 ), ( 312, 216, 52 ), ( 312, 240, 39 ), ( 312, 264, 26 ), ( 312, 288, 13 ),

( 336, 0, 182 ), ( 336, 24, 169 ), ( 336, 48, 156 ), ( 336, 72, 143 ), ( 336, 96, 130 ), ( 336, 120, 117 ), ( 336, 144, 104 ), ( 336, 168, 91 ), ( 336, 192, 78 ), ( 336, 216, 65 ), ( 336, 240, 52 ), ( 336, 264, 39 ), ( 336, 288, 26 ), ( 336, 312, 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)