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

( 24, 0, 1 ),

( 48, 0, 2 ), ( 48, 24, 1 ),

( 72, 0, 3 ), ( 72, 24, 2 ), ( 72, 48, 1 ),

( 96, 0, 4 ), ( 96, 24, 3 ), ( 96, 48, 2 ), ( 96, 72, 1 ),

( 120, 0, 5 ), ( 120, 24, 4 ), ( 120, 48, 3 ), ( 120, 72, 2 ), ( 120, 96, 1 ),

( 144, 0, 6 ), ( 144, 24, 5 ), ( 144, 48, 4 ), ( 144, 72, 3 ), ( 144, 96, 2 ), ( 144, 120, 1 ),

( 168, 0, 7 ), ( 168, 24, 6 ), ( 168, 48, 5 ), ( 168, 72, 4 ), ( 168, 96, 3 ), ( 168, 120, 2 ), ( 168, 144, 1 ),

( 192, 0, 8 ), ( 192, 24, 7 ), ( 192, 48, 6 ), ( 192, 72, 5 ), ( 192, 96, 4 ), ( 192, 120, 3 ), ( 192, 144, 2 ), ( 192, 168, 1 ),

( 216, 0, 9 ), ( 216, 24, 8 ), ( 216, 48, 7 ), ( 216, 72, 6 ), ( 216, 96, 5 ), ( 216, 120, 4 ), ( 216, 144, 3 ), ( 216, 168, 2 ), ( 216, 192, 1 ),

( 240, 0, 10 ), ( 240, 24, 9 ), ( 240, 48, 8 ), ( 240, 72, 7 ), ( 240, 96, 6 ), ( 240, 120, 5 ), ( 240, 144, 4 ), ( 240, 168, 3 ), ( 240, 192, 2 ), ( 240, 216, 1 ),

( 264, 0, 11 ), ( 264, 24, 10 ), ( 264, 48, 9 ), ( 264, 72, 8 ), ( 264, 96, 7 ), ( 264, 120, 6 ), ( 264, 144, 5 ), ( 264, 168, 4 ), ( 264, 192, 3 ), ( 264, 216, 2 ), ( 264, 240, 1 ),

( 288, 0, 12 ), ( 288, 24, 11 ), ( 288, 48, 10 ), ( 288, 72, 9 ), ( 288, 96, 8 ), ( 288, 120, 7 ), ( 288, 144, 6 ), ( 288, 168, 5 ), ( 288, 192, 4 ), ( 288, 216, 3 ), ( 288, 240, 2 ), ( 288, 264, 1 ),

( 312, 0, 13 ), ( 312, 24, 12 ), ( 312, 48, 11 ), ( 312, 72, 10 ), ( 312, 96, 9 ), ( 312, 120, 8 ), ( 312, 144, 7 ), ( 312, 168, 6 ), ( 312, 192, 5 ), ( 312, 216, 4 ), ( 312, 240, 3 ), ( 312, 264, 2 ), ( 312, 288, 1 ),

( 336, 0, 14 ), ( 336, 24, 13 ), ( 336, 48, 12 ), ( 336, 72, 11 ), ( 336, 96, 10 ), ( 336, 120, 9 ), ( 336, 144, 8 ), ( 336, 168, 7 ), ( 336, 192, 6 ), ( 336, 216, 5 ), ( 336, 240, 4 ), ( 336, 264, 3 ), ( 336, 288, 2 ), ( 336, 312, 1 ),

...

}

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)