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

( 47, 0, 7 ),

( 94, 0, 14 ), ( 94, 47, 7 ),

( 141, 0, 21 ), ( 141, 47, 14 ), ( 141, 94, 7 ),

( 188, 0, 28 ), ( 188, 47, 21 ), ( 188, 94, 14 ), ( 188, 141, 7 ),

( 235, 0, 35 ), ( 235, 47, 28 ), ( 235, 94, 21 ), ( 235, 141, 14 ), ( 235, 188, 7 ),

( 282, 0, 42 ), ( 282, 47, 35 ), ( 282, 94, 28 ), ( 282, 141, 21 ), ( 282, 188, 14 ), ( 282, 235, 7 ),

( 329, 0, 49 ), ( 329, 47, 42 ), ( 329, 94, 35 ), ( 329, 141, 28 ), ( 329, 188, 21 ), ( 329, 235, 14 ), ( 329, 282, 7 ),

( 376, 0, 56 ), ( 376, 47, 49 ), ( 376, 94, 42 ), ( 376, 141, 35 ), ( 376, 188, 28 ), ( 376, 235, 21 ), ( 376, 282, 14 ), ( 376, 329, 7 ),

( 423, 0, 63 ), ( 423, 47, 56 ), ( 423, 94, 49 ), ( 423, 141, 42 ), ( 423, 188, 35 ), ( 423, 235, 28 ), ( 423, 282, 21 ), ( 423, 329, 14 ), ( 423, 376, 7 ),

( 470, 0, 70 ), ( 470, 47, 63 ), ( 470, 94, 56 ), ( 470, 141, 49 ), ( 470, 188, 42 ), ( 470, 235, 35 ), ( 470, 282, 28 ), ( 470, 329, 21 ), ( 470, 376, 14 ), ( 470, 423, 7 ),

( 517, 0, 77 ), ( 517, 47, 70 ), ( 517, 94, 63 ), ( 517, 141, 56 ), ( 517, 188, 49 ), ( 517, 235, 42 ), ( 517, 282, 35 ), ( 517, 329, 28 ), ( 517, 376, 21 ), ( 517, 423, 14 ), ( 517, 470, 7 ),

( 564, 0, 84 ), ( 564, 47, 77 ), ( 564, 94, 70 ), ( 564, 141, 63 ), ( 564, 188, 56 ), ( 564, 235, 49 ), ( 564, 282, 42 ), ( 564, 329, 35 ), ( 564, 376, 28 ), ( 564, 423, 21 ), ( 564, 470, 14 ), ( 564, 517, 7 ),

( 611, 0, 91 ), ( 611, 47, 84 ), ( 611, 94, 77 ), ( 611, 141, 70 ), ( 611, 188, 63 ), ( 611, 235, 56 ), ( 611, 282, 49 ), ( 611, 329, 42 ), ( 611, 376, 35 ), ( 611, 423, 28 ), ( 611, 470, 21 ), ( 611, 517, 14 ), ( 611, 564, 7 ),

( 658, 0, 98 ), ( 658, 47, 91 ), ( 658, 94, 84 ), ( 658, 141, 77 ), ( 658, 188, 70 ), ( 658, 235, 63 ), ( 658, 282, 56 ), ( 658, 329, 49 ), ( 658, 376, 42 ), ( 658, 423, 35 ), ( 658, 470, 28 ), ( 658, 517, 21 ), ( 658, 564, 14 ), ( 658, 611, 7 ),

...

}

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)