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

15/2 = (15-0)/2 = {

( 15, 0, 2 ),

( 30, 0, 4 ), ( 30, 15, 2 ),

( 45, 0, 6 ), ( 45, 15, 4 ), ( 45, 30, 2 ),

( 60, 0, 8 ), ( 60, 15, 6 ), ( 60, 30, 4 ), ( 60, 45, 2 ),

( 75, 0, 10 ), ( 75, 15, 8 ), ( 75, 30, 6 ), ( 75, 45, 4 ), ( 75, 60, 2 ),

( 90, 0, 12 ), ( 90, 15, 10 ), ( 90, 30, 8 ), ( 90, 45, 6 ), ( 90, 60, 4 ), ( 90, 75, 2 ),

( 105, 0, 14 ), ( 105, 15, 12 ), ( 105, 30, 10 ), ( 105, 45, 8 ), ( 105, 60, 6 ), ( 105, 75, 4 ), ( 105, 90, 2 ),

( 120, 0, 16 ), ( 120, 15, 14 ), ( 120, 30, 12 ), ( 120, 45, 10 ), ( 120, 60, 8 ), ( 120, 75, 6 ), ( 120, 90, 4 ), ( 120, 105, 2 ),

( 135, 0, 18 ), ( 135, 15, 16 ), ( 135, 30, 14 ), ( 135, 45, 12 ), ( 135, 60, 10 ), ( 135, 75, 8 ), ( 135, 90, 6 ), ( 135, 105, 4 ), ( 135, 120, 2 ),

( 150, 0, 20 ), ( 150, 15, 18 ), ( 150, 30, 16 ), ( 150, 45, 14 ), ( 150, 60, 12 ), ( 150, 75, 10 ), ( 150, 90, 8 ), ( 150, 105, 6 ), ( 150, 120, 4 ), ( 150, 135, 2 ),

( 165, 0, 22 ), ( 165, 15, 20 ), ( 165, 30, 18 ), ( 165, 45, 16 ), ( 165, 60, 14 ), ( 165, 75, 12 ), ( 165, 90, 10 ), ( 165, 105, 8 ), ( 165, 120, 6 ), ( 165, 135, 4 ), ( 165, 150, 2 ),

( 180, 0, 24 ), ( 180, 15, 22 ), ( 180, 30, 20 ), ( 180, 45, 18 ), ( 180, 60, 16 ), ( 180, 75, 14 ), ( 180, 90, 12 ), ( 180, 105, 10 ), ( 180, 120, 8 ), ( 180, 135, 6 ), ( 180, 150, 4 ), ( 180, 165, 2 ),

( 195, 0, 26 ), ( 195, 15, 24 ), ( 195, 30, 22 ), ( 195, 45, 20 ), ( 195, 60, 18 ), ( 195, 75, 16 ), ( 195, 90, 14 ), ( 195, 105, 12 ), ( 195, 120, 10 ), ( 195, 135, 8 ), ( 195, 150, 6 ), ( 195, 165, 4 ), ( 195, 180, 2 ),

( 210, 0, 28 ), ( 210, 15, 26 ), ( 210, 30, 24 ), ( 210, 45, 22 ), ( 210, 60, 20 ), ( 210, 75, 18 ), ( 210, 90, 16 ), ( 210, 105, 14 ), ( 210, 120, 12 ), ( 210, 135, 10 ), ( 210, 150, 8 ), ( 210, 165, 6 ), ( 210, 180, 4 ), ( 210, 195, 2 ),

...

}

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)