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

( 28, 0, 5 ),

( 56, 0, 10 ), ( 56, 28, 5 ),

( 84, 0, 15 ), ( 84, 28, 10 ), ( 84, 56, 5 ),

( 112, 0, 20 ), ( 112, 28, 15 ), ( 112, 56, 10 ), ( 112, 84, 5 ),

( 140, 0, 25 ), ( 140, 28, 20 ), ( 140, 56, 15 ), ( 140, 84, 10 ), ( 140, 112, 5 ),

( 168, 0, 30 ), ( 168, 28, 25 ), ( 168, 56, 20 ), ( 168, 84, 15 ), ( 168, 112, 10 ), ( 168, 140, 5 ),

( 196, 0, 35 ), ( 196, 28, 30 ), ( 196, 56, 25 ), ( 196, 84, 20 ), ( 196, 112, 15 ), ( 196, 140, 10 ), ( 196, 168, 5 ),

( 224, 0, 40 ), ( 224, 28, 35 ), ( 224, 56, 30 ), ( 224, 84, 25 ), ( 224, 112, 20 ), ( 224, 140, 15 ), ( 224, 168, 10 ), ( 224, 196, 5 ),

( 252, 0, 45 ), ( 252, 28, 40 ), ( 252, 56, 35 ), ( 252, 84, 30 ), ( 252, 112, 25 ), ( 252, 140, 20 ), ( 252, 168, 15 ), ( 252, 196, 10 ), ( 252, 224, 5 ),

( 280, 0, 50 ), ( 280, 28, 45 ), ( 280, 56, 40 ), ( 280, 84, 35 ), ( 280, 112, 30 ), ( 280, 140, 25 ), ( 280, 168, 20 ), ( 280, 196, 15 ), ( 280, 224, 10 ), ( 280, 252, 5 ),

( 308, 0, 55 ), ( 308, 28, 50 ), ( 308, 56, 45 ), ( 308, 84, 40 ), ( 308, 112, 35 ), ( 308, 140, 30 ), ( 308, 168, 25 ), ( 308, 196, 20 ), ( 308, 224, 15 ), ( 308, 252, 10 ), ( 308, 280, 5 ),

( 336, 0, 60 ), ( 336, 28, 55 ), ( 336, 56, 50 ), ( 336, 84, 45 ), ( 336, 112, 40 ), ( 336, 140, 35 ), ( 336, 168, 30 ), ( 336, 196, 25 ), ( 336, 224, 20 ), ( 336, 252, 15 ), ( 336, 280, 10 ), ( 336, 308, 5 ),

( 364, 0, 65 ), ( 364, 28, 60 ), ( 364, 56, 55 ), ( 364, 84, 50 ), ( 364, 112, 45 ), ( 364, 140, 40 ), ( 364, 168, 35 ), ( 364, 196, 30 ), ( 364, 224, 25 ), ( 364, 252, 20 ), ( 364, 280, 15 ), ( 364, 308, 10 ), ( 364, 336, 5 ),

( 392, 0, 70 ), ( 392, 28, 65 ), ( 392, 56, 60 ), ( 392, 84, 55 ), ( 392, 112, 50 ), ( 392, 140, 45 ), ( 392, 168, 40 ), ( 392, 196, 35 ), ( 392, 224, 30 ), ( 392, 252, 25 ), ( 392, 280, 20 ), ( 392, 308, 15 ), ( 392, 336, 10 ), ( 392, 364, 5 ),

...

}

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)