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

35/6 = (35-0)/6 = {

( 35, 0, 6 ),

( 70, 0, 12 ), ( 70, 35, 6 ),

( 105, 0, 18 ), ( 105, 35, 12 ), ( 105, 70, 6 ),

( 140, 0, 24 ), ( 140, 35, 18 ), ( 140, 70, 12 ), ( 140, 105, 6 ),

( 175, 0, 30 ), ( 175, 35, 24 ), ( 175, 70, 18 ), ( 175, 105, 12 ), ( 175, 140, 6 ),

( 210, 0, 36 ), ( 210, 35, 30 ), ( 210, 70, 24 ), ( 210, 105, 18 ), ( 210, 140, 12 ), ( 210, 175, 6 ),

( 245, 0, 42 ), ( 245, 35, 36 ), ( 245, 70, 30 ), ( 245, 105, 24 ), ( 245, 140, 18 ), ( 245, 175, 12 ), ( 245, 210, 6 ),

( 280, 0, 48 ), ( 280, 35, 42 ), ( 280, 70, 36 ), ( 280, 105, 30 ), ( 280, 140, 24 ), ( 280, 175, 18 ), ( 280, 210, 12 ), ( 280, 245, 6 ),

( 315, 0, 54 ), ( 315, 35, 48 ), ( 315, 70, 42 ), ( 315, 105, 36 ), ( 315, 140, 30 ), ( 315, 175, 24 ), ( 315, 210, 18 ), ( 315, 245, 12 ), ( 315, 280, 6 ),

( 350, 0, 60 ), ( 350, 35, 54 ), ( 350, 70, 48 ), ( 350, 105, 42 ), ( 350, 140, 36 ), ( 350, 175, 30 ), ( 350, 210, 24 ), ( 350, 245, 18 ), ( 350, 280, 12 ), ( 350, 315, 6 ),

( 385, 0, 66 ), ( 385, 35, 60 ), ( 385, 70, 54 ), ( 385, 105, 48 ), ( 385, 140, 42 ), ( 385, 175, 36 ), ( 385, 210, 30 ), ( 385, 245, 24 ), ( 385, 280, 18 ), ( 385, 315, 12 ), ( 385, 350, 6 ),

( 420, 0, 72 ), ( 420, 35, 66 ), ( 420, 70, 60 ), ( 420, 105, 54 ), ( 420, 140, 48 ), ( 420, 175, 42 ), ( 420, 210, 36 ), ( 420, 245, 30 ), ( 420, 280, 24 ), ( 420, 315, 18 ), ( 420, 350, 12 ), ( 420, 385, 6 ),

( 455, 0, 78 ), ( 455, 35, 72 ), ( 455, 70, 66 ), ( 455, 105, 60 ), ( 455, 140, 54 ), ( 455, 175, 48 ), ( 455, 210, 42 ), ( 455, 245, 36 ), ( 455, 280, 30 ), ( 455, 315, 24 ), ( 455, 350, 18 ), ( 455, 385, 12 ), ( 455, 420, 6 ),

( 490, 0, 84 ), ( 490, 35, 78 ), ( 490, 70, 72 ), ( 490, 105, 66 ), ( 490, 140, 60 ), ( 490, 175, 54 ), ( 490, 210, 48 ), ( 490, 245, 42 ), ( 490, 280, 36 ), ( 490, 315, 30 ), ( 490, 350, 24 ), ( 490, 385, 18 ), ( 490, 420, 12 ), ( 490, 455, 6 ),

...

}

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)