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

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

( 35, 0, 17 ),

( 70, 0, 34 ), ( 70, 35, 17 ),

( 105, 0, 51 ), ( 105, 35, 34 ), ( 105, 70, 17 ),

( 140, 0, 68 ), ( 140, 35, 51 ), ( 140, 70, 34 ), ( 140, 105, 17 ),

( 175, 0, 85 ), ( 175, 35, 68 ), ( 175, 70, 51 ), ( 175, 105, 34 ), ( 175, 140, 17 ),

( 210, 0, 102 ), ( 210, 35, 85 ), ( 210, 70, 68 ), ( 210, 105, 51 ), ( 210, 140, 34 ), ( 210, 175, 17 ),

( 245, 0, 119 ), ( 245, 35, 102 ), ( 245, 70, 85 ), ( 245, 105, 68 ), ( 245, 140, 51 ), ( 245, 175, 34 ), ( 245, 210, 17 ),

( 280, 0, 136 ), ( 280, 35, 119 ), ( 280, 70, 102 ), ( 280, 105, 85 ), ( 280, 140, 68 ), ( 280, 175, 51 ), ( 280, 210, 34 ), ( 280, 245, 17 ),

( 315, 0, 153 ), ( 315, 35, 136 ), ( 315, 70, 119 ), ( 315, 105, 102 ), ( 315, 140, 85 ), ( 315, 175, 68 ), ( 315, 210, 51 ), ( 315, 245, 34 ), ( 315, 280, 17 ),

( 350, 0, 170 ), ( 350, 35, 153 ), ( 350, 70, 136 ), ( 350, 105, 119 ), ( 350, 140, 102 ), ( 350, 175, 85 ), ( 350, 210, 68 ), ( 350, 245, 51 ), ( 350, 280, 34 ), ( 350, 315, 17 ),

( 385, 0, 187 ), ( 385, 35, 170 ), ( 385, 70, 153 ), ( 385, 105, 136 ), ( 385, 140, 119 ), ( 385, 175, 102 ), ( 385, 210, 85 ), ( 385, 245, 68 ), ( 385, 280, 51 ), ( 385, 315, 34 ), ( 385, 350, 17 ),

( 420, 0, 204 ), ( 420, 35, 187 ), ( 420, 70, 170 ), ( 420, 105, 153 ), ( 420, 140, 136 ), ( 420, 175, 119 ), ( 420, 210, 102 ), ( 420, 245, 85 ), ( 420, 280, 68 ), ( 420, 315, 51 ), ( 420, 350, 34 ), ( 420, 385, 17 ),

( 455, 0, 221 ), ( 455, 35, 204 ), ( 455, 70, 187 ), ( 455, 105, 170 ), ( 455, 140, 153 ), ( 455, 175, 136 ), ( 455, 210, 119 ), ( 455, 245, 102 ), ( 455, 280, 85 ), ( 455, 315, 68 ), ( 455, 350, 51 ), ( 455, 385, 34 ), ( 455, 420, 17 ),

( 490, 0, 238 ), ( 490, 35, 221 ), ( 490, 70, 204 ), ( 490, 105, 187 ), ( 490, 140, 170 ), ( 490, 175, 153 ), ( 490, 210, 136 ), ( 490, 245, 119 ), ( 490, 280, 102 ), ( 490, 315, 85 ), ( 490, 350, 68 ), ( 490, 385, 51 ), ( 490, 420, 34 ), ( 490, 455, 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)