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

( 47, 0, 22 ),

( 94, 0, 44 ), ( 94, 47, 22 ),

( 141, 0, 66 ), ( 141, 47, 44 ), ( 141, 94, 22 ),

( 188, 0, 88 ), ( 188, 47, 66 ), ( 188, 94, 44 ), ( 188, 141, 22 ),

( 235, 0, 110 ), ( 235, 47, 88 ), ( 235, 94, 66 ), ( 235, 141, 44 ), ( 235, 188, 22 ),

( 282, 0, 132 ), ( 282, 47, 110 ), ( 282, 94, 88 ), ( 282, 141, 66 ), ( 282, 188, 44 ), ( 282, 235, 22 ),

( 329, 0, 154 ), ( 329, 47, 132 ), ( 329, 94, 110 ), ( 329, 141, 88 ), ( 329, 188, 66 ), ( 329, 235, 44 ), ( 329, 282, 22 ),

( 376, 0, 176 ), ( 376, 47, 154 ), ( 376, 94, 132 ), ( 376, 141, 110 ), ( 376, 188, 88 ), ( 376, 235, 66 ), ( 376, 282, 44 ), ( 376, 329, 22 ),

( 423, 0, 198 ), ( 423, 47, 176 ), ( 423, 94, 154 ), ( 423, 141, 132 ), ( 423, 188, 110 ), ( 423, 235, 88 ), ( 423, 282, 66 ), ( 423, 329, 44 ), ( 423, 376, 22 ),

( 470, 0, 220 ), ( 470, 47, 198 ), ( 470, 94, 176 ), ( 470, 141, 154 ), ( 470, 188, 132 ), ( 470, 235, 110 ), ( 470, 282, 88 ), ( 470, 329, 66 ), ( 470, 376, 44 ), ( 470, 423, 22 ),

( 517, 0, 242 ), ( 517, 47, 220 ), ( 517, 94, 198 ), ( 517, 141, 176 ), ( 517, 188, 154 ), ( 517, 235, 132 ), ( 517, 282, 110 ), ( 517, 329, 88 ), ( 517, 376, 66 ), ( 517, 423, 44 ), ( 517, 470, 22 ),

( 564, 0, 264 ), ( 564, 47, 242 ), ( 564, 94, 220 ), ( 564, 141, 198 ), ( 564, 188, 176 ), ( 564, 235, 154 ), ( 564, 282, 132 ), ( 564, 329, 110 ), ( 564, 376, 88 ), ( 564, 423, 66 ), ( 564, 470, 44 ), ( 564, 517, 22 ),

( 611, 0, 286 ), ( 611, 47, 264 ), ( 611, 94, 242 ), ( 611, 141, 220 ), ( 611, 188, 198 ), ( 611, 235, 176 ), ( 611, 282, 154 ), ( 611, 329, 132 ), ( 611, 376, 110 ), ( 611, 423, 88 ), ( 611, 470, 66 ), ( 611, 517, 44 ), ( 611, 564, 22 ),

( 658, 0, 308 ), ( 658, 47, 286 ), ( 658, 94, 264 ), ( 658, 141, 242 ), ( 658, 188, 220 ), ( 658, 235, 198 ), ( 658, 282, 176 ), ( 658, 329, 154 ), ( 658, 376, 132 ), ( 658, 423, 110 ), ( 658, 470, 88 ), ( 658, 517, 66 ), ( 658, 564, 44 ), ( 658, 611, 22 ),

...

}

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)