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

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

( 25, 0, 2 ),

( 50, 0, 4 ), ( 50, 25, 2 ),

( 75, 0, 6 ), ( 75, 25, 4 ), ( 75, 50, 2 ),

( 100, 0, 8 ), ( 100, 25, 6 ), ( 100, 50, 4 ), ( 100, 75, 2 ),

( 125, 0, 10 ), ( 125, 25, 8 ), ( 125, 50, 6 ), ( 125, 75, 4 ), ( 125, 100, 2 ),

( 150, 0, 12 ), ( 150, 25, 10 ), ( 150, 50, 8 ), ( 150, 75, 6 ), ( 150, 100, 4 ), ( 150, 125, 2 ),

( 175, 0, 14 ), ( 175, 25, 12 ), ( 175, 50, 10 ), ( 175, 75, 8 ), ( 175, 100, 6 ), ( 175, 125, 4 ), ( 175, 150, 2 ),

( 200, 0, 16 ), ( 200, 25, 14 ), ( 200, 50, 12 ), ( 200, 75, 10 ), ( 200, 100, 8 ), ( 200, 125, 6 ), ( 200, 150, 4 ), ( 200, 175, 2 ),

( 225, 0, 18 ), ( 225, 25, 16 ), ( 225, 50, 14 ), ( 225, 75, 12 ), ( 225, 100, 10 ), ( 225, 125, 8 ), ( 225, 150, 6 ), ( 225, 175, 4 ), ( 225, 200, 2 ),

( 250, 0, 20 ), ( 250, 25, 18 ), ( 250, 50, 16 ), ( 250, 75, 14 ), ( 250, 100, 12 ), ( 250, 125, 10 ), ( 250, 150, 8 ), ( 250, 175, 6 ), ( 250, 200, 4 ), ( 250, 225, 2 ),

( 275, 0, 22 ), ( 275, 25, 20 ), ( 275, 50, 18 ), ( 275, 75, 16 ), ( 275, 100, 14 ), ( 275, 125, 12 ), ( 275, 150, 10 ), ( 275, 175, 8 ), ( 275, 200, 6 ), ( 275, 225, 4 ), ( 275, 250, 2 ),

( 300, 0, 24 ), ( 300, 25, 22 ), ( 300, 50, 20 ), ( 300, 75, 18 ), ( 300, 100, 16 ), ( 300, 125, 14 ), ( 300, 150, 12 ), ( 300, 175, 10 ), ( 300, 200, 8 ), ( 300, 225, 6 ), ( 300, 250, 4 ), ( 300, 275, 2 ),

( 325, 0, 26 ), ( 325, 25, 24 ), ( 325, 50, 22 ), ( 325, 75, 20 ), ( 325, 100, 18 ), ( 325, 125, 16 ), ( 325, 150, 14 ), ( 325, 175, 12 ), ( 325, 200, 10 ), ( 325, 225, 8 ), ( 325, 250, 6 ), ( 325, 275, 4 ), ( 325, 300, 2 ),

( 350, 0, 28 ), ( 350, 25, 26 ), ( 350, 50, 24 ), ( 350, 75, 22 ), ( 350, 100, 20 ), ( 350, 125, 18 ), ( 350, 150, 16 ), ( 350, 175, 14 ), ( 350, 200, 12 ), ( 350, 225, 10 ), ( 350, 250, 8 ), ( 350, 275, 6 ), ( 350, 300, 4 ), ( 350, 325, 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)