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

( 35, 0, 3 ),

( 70, 0, 6 ), ( 70, 35, 3 ),

( 105, 0, 9 ), ( 105, 35, 6 ), ( 105, 70, 3 ),

( 140, 0, 12 ), ( 140, 35, 9 ), ( 140, 70, 6 ), ( 140, 105, 3 ),

( 175, 0, 15 ), ( 175, 35, 12 ), ( 175, 70, 9 ), ( 175, 105, 6 ), ( 175, 140, 3 ),

( 210, 0, 18 ), ( 210, 35, 15 ), ( 210, 70, 12 ), ( 210, 105, 9 ), ( 210, 140, 6 ), ( 210, 175, 3 ),

( 245, 0, 21 ), ( 245, 35, 18 ), ( 245, 70, 15 ), ( 245, 105, 12 ), ( 245, 140, 9 ), ( 245, 175, 6 ), ( 245, 210, 3 ),

( 280, 0, 24 ), ( 280, 35, 21 ), ( 280, 70, 18 ), ( 280, 105, 15 ), ( 280, 140, 12 ), ( 280, 175, 9 ), ( 280, 210, 6 ), ( 280, 245, 3 ),

( 315, 0, 27 ), ( 315, 35, 24 ), ( 315, 70, 21 ), ( 315, 105, 18 ), ( 315, 140, 15 ), ( 315, 175, 12 ), ( 315, 210, 9 ), ( 315, 245, 6 ), ( 315, 280, 3 ),

( 350, 0, 30 ), ( 350, 35, 27 ), ( 350, 70, 24 ), ( 350, 105, 21 ), ( 350, 140, 18 ), ( 350, 175, 15 ), ( 350, 210, 12 ), ( 350, 245, 9 ), ( 350, 280, 6 ), ( 350, 315, 3 ),

( 385, 0, 33 ), ( 385, 35, 30 ), ( 385, 70, 27 ), ( 385, 105, 24 ), ( 385, 140, 21 ), ( 385, 175, 18 ), ( 385, 210, 15 ), ( 385, 245, 12 ), ( 385, 280, 9 ), ( 385, 315, 6 ), ( 385, 350, 3 ),

( 420, 0, 36 ), ( 420, 35, 33 ), ( 420, 70, 30 ), ( 420, 105, 27 ), ( 420, 140, 24 ), ( 420, 175, 21 ), ( 420, 210, 18 ), ( 420, 245, 15 ), ( 420, 280, 12 ), ( 420, 315, 9 ), ( 420, 350, 6 ), ( 420, 385, 3 ),

( 455, 0, 39 ), ( 455, 35, 36 ), ( 455, 70, 33 ), ( 455, 105, 30 ), ( 455, 140, 27 ), ( 455, 175, 24 ), ( 455, 210, 21 ), ( 455, 245, 18 ), ( 455, 280, 15 ), ( 455, 315, 12 ), ( 455, 350, 9 ), ( 455, 385, 6 ), ( 455, 420, 3 ),

( 490, 0, 42 ), ( 490, 35, 39 ), ( 490, 70, 36 ), ( 490, 105, 33 ), ( 490, 140, 30 ), ( 490, 175, 27 ), ( 490, 210, 24 ), ( 490, 245, 21 ), ( 490, 280, 18 ), ( 490, 315, 15 ), ( 490, 350, 12 ), ( 490, 385, 9 ), ( 490, 420, 6 ), ( 490, 455, 3 ),

...

}

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)