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

( 25, 0, 12 ),

( 50, 0, 24 ), ( 50, 25, 12 ),

( 75, 0, 36 ), ( 75, 25, 24 ), ( 75, 50, 12 ),

( 100, 0, 48 ), ( 100, 25, 36 ), ( 100, 50, 24 ), ( 100, 75, 12 ),

( 125, 0, 60 ), ( 125, 25, 48 ), ( 125, 50, 36 ), ( 125, 75, 24 ), ( 125, 100, 12 ),

( 150, 0, 72 ), ( 150, 25, 60 ), ( 150, 50, 48 ), ( 150, 75, 36 ), ( 150, 100, 24 ), ( 150, 125, 12 ),

( 175, 0, 84 ), ( 175, 25, 72 ), ( 175, 50, 60 ), ( 175, 75, 48 ), ( 175, 100, 36 ), ( 175, 125, 24 ), ( 175, 150, 12 ),

( 200, 0, 96 ), ( 200, 25, 84 ), ( 200, 50, 72 ), ( 200, 75, 60 ), ( 200, 100, 48 ), ( 200, 125, 36 ), ( 200, 150, 24 ), ( 200, 175, 12 ),

( 225, 0, 108 ), ( 225, 25, 96 ), ( 225, 50, 84 ), ( 225, 75, 72 ), ( 225, 100, 60 ), ( 225, 125, 48 ), ( 225, 150, 36 ), ( 225, 175, 24 ), ( 225, 200, 12 ),

( 250, 0, 120 ), ( 250, 25, 108 ), ( 250, 50, 96 ), ( 250, 75, 84 ), ( 250, 100, 72 ), ( 250, 125, 60 ), ( 250, 150, 48 ), ( 250, 175, 36 ), ( 250, 200, 24 ), ( 250, 225, 12 ),

( 275, 0, 132 ), ( 275, 25, 120 ), ( 275, 50, 108 ), ( 275, 75, 96 ), ( 275, 100, 84 ), ( 275, 125, 72 ), ( 275, 150, 60 ), ( 275, 175, 48 ), ( 275, 200, 36 ), ( 275, 225, 24 ), ( 275, 250, 12 ),

( 300, 0, 144 ), ( 300, 25, 132 ), ( 300, 50, 120 ), ( 300, 75, 108 ), ( 300, 100, 96 ), ( 300, 125, 84 ), ( 300, 150, 72 ), ( 300, 175, 60 ), ( 300, 200, 48 ), ( 300, 225, 36 ), ( 300, 250, 24 ), ( 300, 275, 12 ),

( 325, 0, 156 ), ( 325, 25, 144 ), ( 325, 50, 132 ), ( 325, 75, 120 ), ( 325, 100, 108 ), ( 325, 125, 96 ), ( 325, 150, 84 ), ( 325, 175, 72 ), ( 325, 200, 60 ), ( 325, 225, 48 ), ( 325, 250, 36 ), ( 325, 275, 24 ), ( 325, 300, 12 ),

( 350, 0, 168 ), ( 350, 25, 156 ), ( 350, 50, 144 ), ( 350, 75, 132 ), ( 350, 100, 120 ), ( 350, 125, 108 ), ( 350, 150, 96 ), ( 350, 175, 84 ), ( 350, 200, 72 ), ( 350, 225, 60 ), ( 350, 250, 48 ), ( 350, 275, 36 ), ( 350, 300, 24 ), ( 350, 325, 12 ),

...

}

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)