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

( 25, 0, 3 ),

( 50, 0, 6 ), ( 50, 25, 3 ),

( 75, 0, 9 ), ( 75, 25, 6 ), ( 75, 50, 3 ),

( 100, 0, 12 ), ( 100, 25, 9 ), ( 100, 50, 6 ), ( 100, 75, 3 ),

( 125, 0, 15 ), ( 125, 25, 12 ), ( 125, 50, 9 ), ( 125, 75, 6 ), ( 125, 100, 3 ),

( 150, 0, 18 ), ( 150, 25, 15 ), ( 150, 50, 12 ), ( 150, 75, 9 ), ( 150, 100, 6 ), ( 150, 125, 3 ),

( 175, 0, 21 ), ( 175, 25, 18 ), ( 175, 50, 15 ), ( 175, 75, 12 ), ( 175, 100, 9 ), ( 175, 125, 6 ), ( 175, 150, 3 ),

( 200, 0, 24 ), ( 200, 25, 21 ), ( 200, 50, 18 ), ( 200, 75, 15 ), ( 200, 100, 12 ), ( 200, 125, 9 ), ( 200, 150, 6 ), ( 200, 175, 3 ),

( 225, 0, 27 ), ( 225, 25, 24 ), ( 225, 50, 21 ), ( 225, 75, 18 ), ( 225, 100, 15 ), ( 225, 125, 12 ), ( 225, 150, 9 ), ( 225, 175, 6 ), ( 225, 200, 3 ),

( 250, 0, 30 ), ( 250, 25, 27 ), ( 250, 50, 24 ), ( 250, 75, 21 ), ( 250, 100, 18 ), ( 250, 125, 15 ), ( 250, 150, 12 ), ( 250, 175, 9 ), ( 250, 200, 6 ), ( 250, 225, 3 ),

( 275, 0, 33 ), ( 275, 25, 30 ), ( 275, 50, 27 ), ( 275, 75, 24 ), ( 275, 100, 21 ), ( 275, 125, 18 ), ( 275, 150, 15 ), ( 275, 175, 12 ), ( 275, 200, 9 ), ( 275, 225, 6 ), ( 275, 250, 3 ),

( 300, 0, 36 ), ( 300, 25, 33 ), ( 300, 50, 30 ), ( 300, 75, 27 ), ( 300, 100, 24 ), ( 300, 125, 21 ), ( 300, 150, 18 ), ( 300, 175, 15 ), ( 300, 200, 12 ), ( 300, 225, 9 ), ( 300, 250, 6 ), ( 300, 275, 3 ),

( 325, 0, 39 ), ( 325, 25, 36 ), ( 325, 50, 33 ), ( 325, 75, 30 ), ( 325, 100, 27 ), ( 325, 125, 24 ), ( 325, 150, 21 ), ( 325, 175, 18 ), ( 325, 200, 15 ), ( 325, 225, 12 ), ( 325, 250, 9 ), ( 325, 275, 6 ), ( 325, 300, 3 ),

( 350, 0, 42 ), ( 350, 25, 39 ), ( 350, 50, 36 ), ( 350, 75, 33 ), ( 350, 100, 30 ), ( 350, 125, 27 ), ( 350, 150, 24 ), ( 350, 175, 21 ), ( 350, 200, 18 ), ( 350, 225, 15 ), ( 350, 250, 12 ), ( 350, 275, 9 ), ( 350, 300, 6 ), ( 350, 325, 3 ),

...

}

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)