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

47/20 = (47-0)/20 = {

( 47, 0, 20 ),

( 94, 0, 40 ), ( 94, 47, 20 ),

( 141, 0, 60 ), ( 141, 47, 40 ), ( 141, 94, 20 ),

( 188, 0, 80 ), ( 188, 47, 60 ), ( 188, 94, 40 ), ( 188, 141, 20 ),

( 235, 0, 100 ), ( 235, 47, 80 ), ( 235, 94, 60 ), ( 235, 141, 40 ), ( 235, 188, 20 ),

( 282, 0, 120 ), ( 282, 47, 100 ), ( 282, 94, 80 ), ( 282, 141, 60 ), ( 282, 188, 40 ), ( 282, 235, 20 ),

( 329, 0, 140 ), ( 329, 47, 120 ), ( 329, 94, 100 ), ( 329, 141, 80 ), ( 329, 188, 60 ), ( 329, 235, 40 ), ( 329, 282, 20 ),

( 376, 0, 160 ), ( 376, 47, 140 ), ( 376, 94, 120 ), ( 376, 141, 100 ), ( 376, 188, 80 ), ( 376, 235, 60 ), ( 376, 282, 40 ), ( 376, 329, 20 ),

( 423, 0, 180 ), ( 423, 47, 160 ), ( 423, 94, 140 ), ( 423, 141, 120 ), ( 423, 188, 100 ), ( 423, 235, 80 ), ( 423, 282, 60 ), ( 423, 329, 40 ), ( 423, 376, 20 ),

( 470, 0, 200 ), ( 470, 47, 180 ), ( 470, 94, 160 ), ( 470, 141, 140 ), ( 470, 188, 120 ), ( 470, 235, 100 ), ( 470, 282, 80 ), ( 470, 329, 60 ), ( 470, 376, 40 ), ( 470, 423, 20 ),

( 517, 0, 220 ), ( 517, 47, 200 ), ( 517, 94, 180 ), ( 517, 141, 160 ), ( 517, 188, 140 ), ( 517, 235, 120 ), ( 517, 282, 100 ), ( 517, 329, 80 ), ( 517, 376, 60 ), ( 517, 423, 40 ), ( 517, 470, 20 ),

( 564, 0, 240 ), ( 564, 47, 220 ), ( 564, 94, 200 ), ( 564, 141, 180 ), ( 564, 188, 160 ), ( 564, 235, 140 ), ( 564, 282, 120 ), ( 564, 329, 100 ), ( 564, 376, 80 ), ( 564, 423, 60 ), ( 564, 470, 40 ), ( 564, 517, 20 ),

( 611, 0, 260 ), ( 611, 47, 240 ), ( 611, 94, 220 ), ( 611, 141, 200 ), ( 611, 188, 180 ), ( 611, 235, 160 ), ( 611, 282, 140 ), ( 611, 329, 120 ), ( 611, 376, 100 ), ( 611, 423, 80 ), ( 611, 470, 60 ), ( 611, 517, 40 ), ( 611, 564, 20 ),

( 658, 0, 280 ), ( 658, 47, 260 ), ( 658, 94, 240 ), ( 658, 141, 220 ), ( 658, 188, 200 ), ( 658, 235, 180 ), ( 658, 282, 160 ), ( 658, 329, 140 ), ( 658, 376, 120 ), ( 658, 423, 100 ), ( 658, 470, 80 ), ( 658, 517, 60 ), ( 658, 564, 40 ), ( 658, 611, 20 ),

...

}

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)