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

30/17 = (30-0)/17 = {

( 30, 0, 17 ),

( 60, 0, 34 ), ( 60, 30, 17 ),

( 90, 0, 51 ), ( 90, 30, 34 ), ( 90, 60, 17 ),

( 120, 0, 68 ), ( 120, 30, 51 ), ( 120, 60, 34 ), ( 120, 90, 17 ),

( 150, 0, 85 ), ( 150, 30, 68 ), ( 150, 60, 51 ), ( 150, 90, 34 ), ( 150, 120, 17 ),

( 180, 0, 102 ), ( 180, 30, 85 ), ( 180, 60, 68 ), ( 180, 90, 51 ), ( 180, 120, 34 ), ( 180, 150, 17 ),

( 210, 0, 119 ), ( 210, 30, 102 ), ( 210, 60, 85 ), ( 210, 90, 68 ), ( 210, 120, 51 ), ( 210, 150, 34 ), ( 210, 180, 17 ),

( 240, 0, 136 ), ( 240, 30, 119 ), ( 240, 60, 102 ), ( 240, 90, 85 ), ( 240, 120, 68 ), ( 240, 150, 51 ), ( 240, 180, 34 ), ( 240, 210, 17 ),

( 270, 0, 153 ), ( 270, 30, 136 ), ( 270, 60, 119 ), ( 270, 90, 102 ), ( 270, 120, 85 ), ( 270, 150, 68 ), ( 270, 180, 51 ), ( 270, 210, 34 ), ( 270, 240, 17 ),

( 300, 0, 170 ), ( 300, 30, 153 ), ( 300, 60, 136 ), ( 300, 90, 119 ), ( 300, 120, 102 ), ( 300, 150, 85 ), ( 300, 180, 68 ), ( 300, 210, 51 ), ( 300, 240, 34 ), ( 300, 270, 17 ),

( 330, 0, 187 ), ( 330, 30, 170 ), ( 330, 60, 153 ), ( 330, 90, 136 ), ( 330, 120, 119 ), ( 330, 150, 102 ), ( 330, 180, 85 ), ( 330, 210, 68 ), ( 330, 240, 51 ), ( 330, 270, 34 ), ( 330, 300, 17 ),

( 360, 0, 204 ), ( 360, 30, 187 ), ( 360, 60, 170 ), ( 360, 90, 153 ), ( 360, 120, 136 ), ( 360, 150, 119 ), ( 360, 180, 102 ), ( 360, 210, 85 ), ( 360, 240, 68 ), ( 360, 270, 51 ), ( 360, 300, 34 ), ( 360, 330, 17 ),

( 390, 0, 221 ), ( 390, 30, 204 ), ( 390, 60, 187 ), ( 390, 90, 170 ), ( 390, 120, 153 ), ( 390, 150, 136 ), ( 390, 180, 119 ), ( 390, 210, 102 ), ( 390, 240, 85 ), ( 390, 270, 68 ), ( 390, 300, 51 ), ( 390, 330, 34 ), ( 390, 360, 17 ),

( 420, 0, 238 ), ( 420, 30, 221 ), ( 420, 60, 204 ), ( 420, 90, 187 ), ( 420, 120, 170 ), ( 420, 150, 153 ), ( 420, 180, 136 ), ( 420, 210, 119 ), ( 420, 240, 102 ), ( 420, 270, 85 ), ( 420, 300, 68 ), ( 420, 330, 51 ), ( 420, 360, 34 ), ( 420, 390, 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)