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

( 47, 0, 30 ),

( 94, 0, 60 ), ( 94, 47, 30 ),

( 141, 0, 90 ), ( 141, 47, 60 ), ( 141, 94, 30 ),

( 188, 0, 120 ), ( 188, 47, 90 ), ( 188, 94, 60 ), ( 188, 141, 30 ),

( 235, 0, 150 ), ( 235, 47, 120 ), ( 235, 94, 90 ), ( 235, 141, 60 ), ( 235, 188, 30 ),

( 282, 0, 180 ), ( 282, 47, 150 ), ( 282, 94, 120 ), ( 282, 141, 90 ), ( 282, 188, 60 ), ( 282, 235, 30 ),

( 329, 0, 210 ), ( 329, 47, 180 ), ( 329, 94, 150 ), ( 329, 141, 120 ), ( 329, 188, 90 ), ( 329, 235, 60 ), ( 329, 282, 30 ),

( 376, 0, 240 ), ( 376, 47, 210 ), ( 376, 94, 180 ), ( 376, 141, 150 ), ( 376, 188, 120 ), ( 376, 235, 90 ), ( 376, 282, 60 ), ( 376, 329, 30 ),

( 423, 0, 270 ), ( 423, 47, 240 ), ( 423, 94, 210 ), ( 423, 141, 180 ), ( 423, 188, 150 ), ( 423, 235, 120 ), ( 423, 282, 90 ), ( 423, 329, 60 ), ( 423, 376, 30 ),

( 470, 0, 300 ), ( 470, 47, 270 ), ( 470, 94, 240 ), ( 470, 141, 210 ), ( 470, 188, 180 ), ( 470, 235, 150 ), ( 470, 282, 120 ), ( 470, 329, 90 ), ( 470, 376, 60 ), ( 470, 423, 30 ),

( 517, 0, 330 ), ( 517, 47, 300 ), ( 517, 94, 270 ), ( 517, 141, 240 ), ( 517, 188, 210 ), ( 517, 235, 180 ), ( 517, 282, 150 ), ( 517, 329, 120 ), ( 517, 376, 90 ), ( 517, 423, 60 ), ( 517, 470, 30 ),

( 564, 0, 360 ), ( 564, 47, 330 ), ( 564, 94, 300 ), ( 564, 141, 270 ), ( 564, 188, 240 ), ( 564, 235, 210 ), ( 564, 282, 180 ), ( 564, 329, 150 ), ( 564, 376, 120 ), ( 564, 423, 90 ), ( 564, 470, 60 ), ( 564, 517, 30 ),

( 611, 0, 390 ), ( 611, 47, 360 ), ( 611, 94, 330 ), ( 611, 141, 300 ), ( 611, 188, 270 ), ( 611, 235, 240 ), ( 611, 282, 210 ), ( 611, 329, 180 ), ( 611, 376, 150 ), ( 611, 423, 120 ), ( 611, 470, 90 ), ( 611, 517, 60 ), ( 611, 564, 30 ),

( 658, 0, 420 ), ( 658, 47, 390 ), ( 658, 94, 360 ), ( 658, 141, 330 ), ( 658, 188, 300 ), ( 658, 235, 270 ), ( 658, 282, 240 ), ( 658, 329, 210 ), ( 658, 376, 180 ), ( 658, 423, 150 ), ( 658, 470, 120 ), ( 658, 517, 90 ), ( 658, 564, 60 ), ( 658, 611, 30 ),

...

}

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)