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

28/3 = (28-0)/3 = {

( 28, 0, 3 ),

( 56, 0, 6 ), ( 56, 28, 3 ),

( 84, 0, 9 ), ( 84, 28, 6 ), ( 84, 56, 3 ),

( 112, 0, 12 ), ( 112, 28, 9 ), ( 112, 56, 6 ), ( 112, 84, 3 ),

( 140, 0, 15 ), ( 140, 28, 12 ), ( 140, 56, 9 ), ( 140, 84, 6 ), ( 140, 112, 3 ),

( 168, 0, 18 ), ( 168, 28, 15 ), ( 168, 56, 12 ), ( 168, 84, 9 ), ( 168, 112, 6 ), ( 168, 140, 3 ),

( 196, 0, 21 ), ( 196, 28, 18 ), ( 196, 56, 15 ), ( 196, 84, 12 ), ( 196, 112, 9 ), ( 196, 140, 6 ), ( 196, 168, 3 ),

( 224, 0, 24 ), ( 224, 28, 21 ), ( 224, 56, 18 ), ( 224, 84, 15 ), ( 224, 112, 12 ), ( 224, 140, 9 ), ( 224, 168, 6 ), ( 224, 196, 3 ),

( 252, 0, 27 ), ( 252, 28, 24 ), ( 252, 56, 21 ), ( 252, 84, 18 ), ( 252, 112, 15 ), ( 252, 140, 12 ), ( 252, 168, 9 ), ( 252, 196, 6 ), ( 252, 224, 3 ),

( 280, 0, 30 ), ( 280, 28, 27 ), ( 280, 56, 24 ), ( 280, 84, 21 ), ( 280, 112, 18 ), ( 280, 140, 15 ), ( 280, 168, 12 ), ( 280, 196, 9 ), ( 280, 224, 6 ), ( 280, 252, 3 ),

( 308, 0, 33 ), ( 308, 28, 30 ), ( 308, 56, 27 ), ( 308, 84, 24 ), ( 308, 112, 21 ), ( 308, 140, 18 ), ( 308, 168, 15 ), ( 308, 196, 12 ), ( 308, 224, 9 ), ( 308, 252, 6 ), ( 308, 280, 3 ),

( 336, 0, 36 ), ( 336, 28, 33 ), ( 336, 56, 30 ), ( 336, 84, 27 ), ( 336, 112, 24 ), ( 336, 140, 21 ), ( 336, 168, 18 ), ( 336, 196, 15 ), ( 336, 224, 12 ), ( 336, 252, 9 ), ( 336, 280, 6 ), ( 336, 308, 3 ),

( 364, 0, 39 ), ( 364, 28, 36 ), ( 364, 56, 33 ), ( 364, 84, 30 ), ( 364, 112, 27 ), ( 364, 140, 24 ), ( 364, 168, 21 ), ( 364, 196, 18 ), ( 364, 224, 15 ), ( 364, 252, 12 ), ( 364, 280, 9 ), ( 364, 308, 6 ), ( 364, 336, 3 ),

( 392, 0, 42 ), ( 392, 28, 39 ), ( 392, 56, 36 ), ( 392, 84, 33 ), ( 392, 112, 30 ), ( 392, 140, 27 ), ( 392, 168, 24 ), ( 392, 196, 21 ), ( 392, 224, 18 ), ( 392, 252, 15 ), ( 392, 280, 12 ), ( 392, 308, 9 ), ( 392, 336, 6 ), ( 392, 364, 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)