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

23/10 = (23-0)/10 = {

( 23, 0, 10 ),

( 46, 0, 20 ), ( 46, 23, 10 ),

( 69, 0, 30 ), ( 69, 23, 20 ), ( 69, 46, 10 ),

( 92, 0, 40 ), ( 92, 23, 30 ), ( 92, 46, 20 ), ( 92, 69, 10 ),

( 115, 0, 50 ), ( 115, 23, 40 ), ( 115, 46, 30 ), ( 115, 69, 20 ), ( 115, 92, 10 ),

( 138, 0, 60 ), ( 138, 23, 50 ), ( 138, 46, 40 ), ( 138, 69, 30 ), ( 138, 92, 20 ), ( 138, 115, 10 ),

( 161, 0, 70 ), ( 161, 23, 60 ), ( 161, 46, 50 ), ( 161, 69, 40 ), ( 161, 92, 30 ), ( 161, 115, 20 ), ( 161, 138, 10 ),

( 184, 0, 80 ), ( 184, 23, 70 ), ( 184, 46, 60 ), ( 184, 69, 50 ), ( 184, 92, 40 ), ( 184, 115, 30 ), ( 184, 138, 20 ), ( 184, 161, 10 ),

( 207, 0, 90 ), ( 207, 23, 80 ), ( 207, 46, 70 ), ( 207, 69, 60 ), ( 207, 92, 50 ), ( 207, 115, 40 ), ( 207, 138, 30 ), ( 207, 161, 20 ), ( 207, 184, 10 ),

( 230, 0, 100 ), ( 230, 23, 90 ), ( 230, 46, 80 ), ( 230, 69, 70 ), ( 230, 92, 60 ), ( 230, 115, 50 ), ( 230, 138, 40 ), ( 230, 161, 30 ), ( 230, 184, 20 ), ( 230, 207, 10 ),

( 253, 0, 110 ), ( 253, 23, 100 ), ( 253, 46, 90 ), ( 253, 69, 80 ), ( 253, 92, 70 ), ( 253, 115, 60 ), ( 253, 138, 50 ), ( 253, 161, 40 ), ( 253, 184, 30 ), ( 253, 207, 20 ), ( 253, 230, 10 ),

( 276, 0, 120 ), ( 276, 23, 110 ), ( 276, 46, 100 ), ( 276, 69, 90 ), ( 276, 92, 80 ), ( 276, 115, 70 ), ( 276, 138, 60 ), ( 276, 161, 50 ), ( 276, 184, 40 ), ( 276, 207, 30 ), ( 276, 230, 20 ), ( 276, 253, 10 ),

( 299, 0, 130 ), ( 299, 23, 120 ), ( 299, 46, 110 ), ( 299, 69, 100 ), ( 299, 92, 90 ), ( 299, 115, 80 ), ( 299, 138, 70 ), ( 299, 161, 60 ), ( 299, 184, 50 ), ( 299, 207, 40 ), ( 299, 230, 30 ), ( 299, 253, 20 ), ( 299, 276, 10 ),

( 322, 0, 140 ), ( 322, 23, 130 ), ( 322, 46, 120 ), ( 322, 69, 110 ), ( 322, 92, 100 ), ( 322, 115, 90 ), ( 322, 138, 80 ), ( 322, 161, 70 ), ( 322, 184, 60 ), ( 322, 207, 50 ), ( 322, 230, 40 ), ( 322, 253, 30 ), ( 322, 276, 20 ), ( 322, 299, 10 ),

...

}

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)