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

( 30, 0, 1 ),

( 60, 0, 2 ), ( 60, 30, 1 ),

( 90, 0, 3 ), ( 90, 30, 2 ), ( 90, 60, 1 ),

( 120, 0, 4 ), ( 120, 30, 3 ), ( 120, 60, 2 ), ( 120, 90, 1 ),

( 150, 0, 5 ), ( 150, 30, 4 ), ( 150, 60, 3 ), ( 150, 90, 2 ), ( 150, 120, 1 ),

( 180, 0, 6 ), ( 180, 30, 5 ), ( 180, 60, 4 ), ( 180, 90, 3 ), ( 180, 120, 2 ), ( 180, 150, 1 ),

( 210, 0, 7 ), ( 210, 30, 6 ), ( 210, 60, 5 ), ( 210, 90, 4 ), ( 210, 120, 3 ), ( 210, 150, 2 ), ( 210, 180, 1 ),

( 240, 0, 8 ), ( 240, 30, 7 ), ( 240, 60, 6 ), ( 240, 90, 5 ), ( 240, 120, 4 ), ( 240, 150, 3 ), ( 240, 180, 2 ), ( 240, 210, 1 ),

( 270, 0, 9 ), ( 270, 30, 8 ), ( 270, 60, 7 ), ( 270, 90, 6 ), ( 270, 120, 5 ), ( 270, 150, 4 ), ( 270, 180, 3 ), ( 270, 210, 2 ), ( 270, 240, 1 ),

( 300, 0, 10 ), ( 300, 30, 9 ), ( 300, 60, 8 ), ( 300, 90, 7 ), ( 300, 120, 6 ), ( 300, 150, 5 ), ( 300, 180, 4 ), ( 300, 210, 3 ), ( 300, 240, 2 ), ( 300, 270, 1 ),

( 330, 0, 11 ), ( 330, 30, 10 ), ( 330, 60, 9 ), ( 330, 90, 8 ), ( 330, 120, 7 ), ( 330, 150, 6 ), ( 330, 180, 5 ), ( 330, 210, 4 ), ( 330, 240, 3 ), ( 330, 270, 2 ), ( 330, 300, 1 ),

( 360, 0, 12 ), ( 360, 30, 11 ), ( 360, 60, 10 ), ( 360, 90, 9 ), ( 360, 120, 8 ), ( 360, 150, 7 ), ( 360, 180, 6 ), ( 360, 210, 5 ), ( 360, 240, 4 ), ( 360, 270, 3 ), ( 360, 300, 2 ), ( 360, 330, 1 ),

( 390, 0, 13 ), ( 390, 30, 12 ), ( 390, 60, 11 ), ( 390, 90, 10 ), ( 390, 120, 9 ), ( 390, 150, 8 ), ( 390, 180, 7 ), ( 390, 210, 6 ), ( 390, 240, 5 ), ( 390, 270, 4 ), ( 390, 300, 3 ), ( 390, 330, 2 ), ( 390, 360, 1 ),

( 420, 0, 14 ), ( 420, 30, 13 ), ( 420, 60, 12 ), ( 420, 90, 11 ), ( 420, 120, 10 ), ( 420, 150, 9 ), ( 420, 180, 8 ), ( 420, 210, 7 ), ( 420, 240, 6 ), ( 420, 270, 5 ), ( 420, 300, 4 ), ( 420, 330, 3 ), ( 420, 360, 2 ), ( 420, 390, 1 ),

...

}

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)