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

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

( 19, 0, 10 ),

( 38, 0, 20 ), ( 38, 19, 10 ),

( 57, 0, 30 ), ( 57, 19, 20 ), ( 57, 38, 10 ),

( 76, 0, 40 ), ( 76, 19, 30 ), ( 76, 38, 20 ), ( 76, 57, 10 ),

( 95, 0, 50 ), ( 95, 19, 40 ), ( 95, 38, 30 ), ( 95, 57, 20 ), ( 95, 76, 10 ),

( 114, 0, 60 ), ( 114, 19, 50 ), ( 114, 38, 40 ), ( 114, 57, 30 ), ( 114, 76, 20 ), ( 114, 95, 10 ),

( 133, 0, 70 ), ( 133, 19, 60 ), ( 133, 38, 50 ), ( 133, 57, 40 ), ( 133, 76, 30 ), ( 133, 95, 20 ), ( 133, 114, 10 ),

( 152, 0, 80 ), ( 152, 19, 70 ), ( 152, 38, 60 ), ( 152, 57, 50 ), ( 152, 76, 40 ), ( 152, 95, 30 ), ( 152, 114, 20 ), ( 152, 133, 10 ),

( 171, 0, 90 ), ( 171, 19, 80 ), ( 171, 38, 70 ), ( 171, 57, 60 ), ( 171, 76, 50 ), ( 171, 95, 40 ), ( 171, 114, 30 ), ( 171, 133, 20 ), ( 171, 152, 10 ),

( 190, 0, 100 ), ( 190, 19, 90 ), ( 190, 38, 80 ), ( 190, 57, 70 ), ( 190, 76, 60 ), ( 190, 95, 50 ), ( 190, 114, 40 ), ( 190, 133, 30 ), ( 190, 152, 20 ), ( 190, 171, 10 ),

( 209, 0, 110 ), ( 209, 19, 100 ), ( 209, 38, 90 ), ( 209, 57, 80 ), ( 209, 76, 70 ), ( 209, 95, 60 ), ( 209, 114, 50 ), ( 209, 133, 40 ), ( 209, 152, 30 ), ( 209, 171, 20 ), ( 209, 190, 10 ),

( 228, 0, 120 ), ( 228, 19, 110 ), ( 228, 38, 100 ), ( 228, 57, 90 ), ( 228, 76, 80 ), ( 228, 95, 70 ), ( 228, 114, 60 ), ( 228, 133, 50 ), ( 228, 152, 40 ), ( 228, 171, 30 ), ( 228, 190, 20 ), ( 228, 209, 10 ),

( 247, 0, 130 ), ( 247, 19, 120 ), ( 247, 38, 110 ), ( 247, 57, 100 ), ( 247, 76, 90 ), ( 247, 95, 80 ), ( 247, 114, 70 ), ( 247, 133, 60 ), ( 247, 152, 50 ), ( 247, 171, 40 ), ( 247, 190, 30 ), ( 247, 209, 20 ), ( 247, 228, 10 ),

( 266, 0, 140 ), ( 266, 19, 130 ), ( 266, 38, 120 ), ( 266, 57, 110 ), ( 266, 76, 100 ), ( 266, 95, 90 ), ( 266, 114, 80 ), ( 266, 133, 70 ), ( 266, 152, 60 ), ( 266, 171, 50 ), ( 266, 190, 40 ), ( 266, 209, 30 ), ( 266, 228, 20 ), ( 266, 247, 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)