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

( 35, 0, 4 ),

( 70, 0, 8 ), ( 70, 35, 4 ),

( 105, 0, 12 ), ( 105, 35, 8 ), ( 105, 70, 4 ),

( 140, 0, 16 ), ( 140, 35, 12 ), ( 140, 70, 8 ), ( 140, 105, 4 ),

( 175, 0, 20 ), ( 175, 35, 16 ), ( 175, 70, 12 ), ( 175, 105, 8 ), ( 175, 140, 4 ),

( 210, 0, 24 ), ( 210, 35, 20 ), ( 210, 70, 16 ), ( 210, 105, 12 ), ( 210, 140, 8 ), ( 210, 175, 4 ),

( 245, 0, 28 ), ( 245, 35, 24 ), ( 245, 70, 20 ), ( 245, 105, 16 ), ( 245, 140, 12 ), ( 245, 175, 8 ), ( 245, 210, 4 ),

( 280, 0, 32 ), ( 280, 35, 28 ), ( 280, 70, 24 ), ( 280, 105, 20 ), ( 280, 140, 16 ), ( 280, 175, 12 ), ( 280, 210, 8 ), ( 280, 245, 4 ),

( 315, 0, 36 ), ( 315, 35, 32 ), ( 315, 70, 28 ), ( 315, 105, 24 ), ( 315, 140, 20 ), ( 315, 175, 16 ), ( 315, 210, 12 ), ( 315, 245, 8 ), ( 315, 280, 4 ),

( 350, 0, 40 ), ( 350, 35, 36 ), ( 350, 70, 32 ), ( 350, 105, 28 ), ( 350, 140, 24 ), ( 350, 175, 20 ), ( 350, 210, 16 ), ( 350, 245, 12 ), ( 350, 280, 8 ), ( 350, 315, 4 ),

( 385, 0, 44 ), ( 385, 35, 40 ), ( 385, 70, 36 ), ( 385, 105, 32 ), ( 385, 140, 28 ), ( 385, 175, 24 ), ( 385, 210, 20 ), ( 385, 245, 16 ), ( 385, 280, 12 ), ( 385, 315, 8 ), ( 385, 350, 4 ),

( 420, 0, 48 ), ( 420, 35, 44 ), ( 420, 70, 40 ), ( 420, 105, 36 ), ( 420, 140, 32 ), ( 420, 175, 28 ), ( 420, 210, 24 ), ( 420, 245, 20 ), ( 420, 280, 16 ), ( 420, 315, 12 ), ( 420, 350, 8 ), ( 420, 385, 4 ),

( 455, 0, 52 ), ( 455, 35, 48 ), ( 455, 70, 44 ), ( 455, 105, 40 ), ( 455, 140, 36 ), ( 455, 175, 32 ), ( 455, 210, 28 ), ( 455, 245, 24 ), ( 455, 280, 20 ), ( 455, 315, 16 ), ( 455, 350, 12 ), ( 455, 385, 8 ), ( 455, 420, 4 ),

( 490, 0, 56 ), ( 490, 35, 52 ), ( 490, 70, 48 ), ( 490, 105, 44 ), ( 490, 140, 40 ), ( 490, 175, 36 ), ( 490, 210, 32 ), ( 490, 245, 28 ), ( 490, 280, 24 ), ( 490, 315, 20 ), ( 490, 350, 16 ), ( 490, 385, 12 ), ( 490, 420, 8 ), ( 490, 455, 4 ),

...

}

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)