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

( 35, 0, 16 ),

( 70, 0, 32 ), ( 70, 35, 16 ),

( 105, 0, 48 ), ( 105, 35, 32 ), ( 105, 70, 16 ),

( 140, 0, 64 ), ( 140, 35, 48 ), ( 140, 70, 32 ), ( 140, 105, 16 ),

( 175, 0, 80 ), ( 175, 35, 64 ), ( 175, 70, 48 ), ( 175, 105, 32 ), ( 175, 140, 16 ),

( 210, 0, 96 ), ( 210, 35, 80 ), ( 210, 70, 64 ), ( 210, 105, 48 ), ( 210, 140, 32 ), ( 210, 175, 16 ),

( 245, 0, 112 ), ( 245, 35, 96 ), ( 245, 70, 80 ), ( 245, 105, 64 ), ( 245, 140, 48 ), ( 245, 175, 32 ), ( 245, 210, 16 ),

( 280, 0, 128 ), ( 280, 35, 112 ), ( 280, 70, 96 ), ( 280, 105, 80 ), ( 280, 140, 64 ), ( 280, 175, 48 ), ( 280, 210, 32 ), ( 280, 245, 16 ),

( 315, 0, 144 ), ( 315, 35, 128 ), ( 315, 70, 112 ), ( 315, 105, 96 ), ( 315, 140, 80 ), ( 315, 175, 64 ), ( 315, 210, 48 ), ( 315, 245, 32 ), ( 315, 280, 16 ),

( 350, 0, 160 ), ( 350, 35, 144 ), ( 350, 70, 128 ), ( 350, 105, 112 ), ( 350, 140, 96 ), ( 350, 175, 80 ), ( 350, 210, 64 ), ( 350, 245, 48 ), ( 350, 280, 32 ), ( 350, 315, 16 ),

( 385, 0, 176 ), ( 385, 35, 160 ), ( 385, 70, 144 ), ( 385, 105, 128 ), ( 385, 140, 112 ), ( 385, 175, 96 ), ( 385, 210, 80 ), ( 385, 245, 64 ), ( 385, 280, 48 ), ( 385, 315, 32 ), ( 385, 350, 16 ),

( 420, 0, 192 ), ( 420, 35, 176 ), ( 420, 70, 160 ), ( 420, 105, 144 ), ( 420, 140, 128 ), ( 420, 175, 112 ), ( 420, 210, 96 ), ( 420, 245, 80 ), ( 420, 280, 64 ), ( 420, 315, 48 ), ( 420, 350, 32 ), ( 420, 385, 16 ),

( 455, 0, 208 ), ( 455, 35, 192 ), ( 455, 70, 176 ), ( 455, 105, 160 ), ( 455, 140, 144 ), ( 455, 175, 128 ), ( 455, 210, 112 ), ( 455, 245, 96 ), ( 455, 280, 80 ), ( 455, 315, 64 ), ( 455, 350, 48 ), ( 455, 385, 32 ), ( 455, 420, 16 ),

( 490, 0, 224 ), ( 490, 35, 208 ), ( 490, 70, 192 ), ( 490, 105, 176 ), ( 490, 140, 160 ), ( 490, 175, 144 ), ( 490, 210, 128 ), ( 490, 245, 112 ), ( 490, 280, 96 ), ( 490, 315, 80 ), ( 490, 350, 64 ), ( 490, 385, 48 ), ( 490, 420, 32 ), ( 490, 455, 16 ),

...

}

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)