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

( 28, 0, 17 ),

( 56, 0, 34 ), ( 56, 28, 17 ),

( 84, 0, 51 ), ( 84, 28, 34 ), ( 84, 56, 17 ),

( 112, 0, 68 ), ( 112, 28, 51 ), ( 112, 56, 34 ), ( 112, 84, 17 ),

( 140, 0, 85 ), ( 140, 28, 68 ), ( 140, 56, 51 ), ( 140, 84, 34 ), ( 140, 112, 17 ),

( 168, 0, 102 ), ( 168, 28, 85 ), ( 168, 56, 68 ), ( 168, 84, 51 ), ( 168, 112, 34 ), ( 168, 140, 17 ),

( 196, 0, 119 ), ( 196, 28, 102 ), ( 196, 56, 85 ), ( 196, 84, 68 ), ( 196, 112, 51 ), ( 196, 140, 34 ), ( 196, 168, 17 ),

( 224, 0, 136 ), ( 224, 28, 119 ), ( 224, 56, 102 ), ( 224, 84, 85 ), ( 224, 112, 68 ), ( 224, 140, 51 ), ( 224, 168, 34 ), ( 224, 196, 17 ),

( 252, 0, 153 ), ( 252, 28, 136 ), ( 252, 56, 119 ), ( 252, 84, 102 ), ( 252, 112, 85 ), ( 252, 140, 68 ), ( 252, 168, 51 ), ( 252, 196, 34 ), ( 252, 224, 17 ),

( 280, 0, 170 ), ( 280, 28, 153 ), ( 280, 56, 136 ), ( 280, 84, 119 ), ( 280, 112, 102 ), ( 280, 140, 85 ), ( 280, 168, 68 ), ( 280, 196, 51 ), ( 280, 224, 34 ), ( 280, 252, 17 ),

( 308, 0, 187 ), ( 308, 28, 170 ), ( 308, 56, 153 ), ( 308, 84, 136 ), ( 308, 112, 119 ), ( 308, 140, 102 ), ( 308, 168, 85 ), ( 308, 196, 68 ), ( 308, 224, 51 ), ( 308, 252, 34 ), ( 308, 280, 17 ),

( 336, 0, 204 ), ( 336, 28, 187 ), ( 336, 56, 170 ), ( 336, 84, 153 ), ( 336, 112, 136 ), ( 336, 140, 119 ), ( 336, 168, 102 ), ( 336, 196, 85 ), ( 336, 224, 68 ), ( 336, 252, 51 ), ( 336, 280, 34 ), ( 336, 308, 17 ),

( 364, 0, 221 ), ( 364, 28, 204 ), ( 364, 56, 187 ), ( 364, 84, 170 ), ( 364, 112, 153 ), ( 364, 140, 136 ), ( 364, 168, 119 ), ( 364, 196, 102 ), ( 364, 224, 85 ), ( 364, 252, 68 ), ( 364, 280, 51 ), ( 364, 308, 34 ), ( 364, 336, 17 ),

( 392, 0, 238 ), ( 392, 28, 221 ), ( 392, 56, 204 ), ( 392, 84, 187 ), ( 392, 112, 170 ), ( 392, 140, 153 ), ( 392, 168, 136 ), ( 392, 196, 119 ), ( 392, 224, 102 ), ( 392, 252, 85 ), ( 392, 280, 68 ), ( 392, 308, 51 ), ( 392, 336, 34 ), ( 392, 364, 17 ),

...

}

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)