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

43/22 = (43-0)/22 = {

( 43, 0, 22 ),

( 86, 0, 44 ), ( 86, 43, 22 ),

( 129, 0, 66 ), ( 129, 43, 44 ), ( 129, 86, 22 ),

( 172, 0, 88 ), ( 172, 43, 66 ), ( 172, 86, 44 ), ( 172, 129, 22 ),

( 215, 0, 110 ), ( 215, 43, 88 ), ( 215, 86, 66 ), ( 215, 129, 44 ), ( 215, 172, 22 ),

( 258, 0, 132 ), ( 258, 43, 110 ), ( 258, 86, 88 ), ( 258, 129, 66 ), ( 258, 172, 44 ), ( 258, 215, 22 ),

( 301, 0, 154 ), ( 301, 43, 132 ), ( 301, 86, 110 ), ( 301, 129, 88 ), ( 301, 172, 66 ), ( 301, 215, 44 ), ( 301, 258, 22 ),

( 344, 0, 176 ), ( 344, 43, 154 ), ( 344, 86, 132 ), ( 344, 129, 110 ), ( 344, 172, 88 ), ( 344, 215, 66 ), ( 344, 258, 44 ), ( 344, 301, 22 ),

( 387, 0, 198 ), ( 387, 43, 176 ), ( 387, 86, 154 ), ( 387, 129, 132 ), ( 387, 172, 110 ), ( 387, 215, 88 ), ( 387, 258, 66 ), ( 387, 301, 44 ), ( 387, 344, 22 ),

( 430, 0, 220 ), ( 430, 43, 198 ), ( 430, 86, 176 ), ( 430, 129, 154 ), ( 430, 172, 132 ), ( 430, 215, 110 ), ( 430, 258, 88 ), ( 430, 301, 66 ), ( 430, 344, 44 ), ( 430, 387, 22 ),

( 473, 0, 242 ), ( 473, 43, 220 ), ( 473, 86, 198 ), ( 473, 129, 176 ), ( 473, 172, 154 ), ( 473, 215, 132 ), ( 473, 258, 110 ), ( 473, 301, 88 ), ( 473, 344, 66 ), ( 473, 387, 44 ), ( 473, 430, 22 ),

( 516, 0, 264 ), ( 516, 43, 242 ), ( 516, 86, 220 ), ( 516, 129, 198 ), ( 516, 172, 176 ), ( 516, 215, 154 ), ( 516, 258, 132 ), ( 516, 301, 110 ), ( 516, 344, 88 ), ( 516, 387, 66 ), ( 516, 430, 44 ), ( 516, 473, 22 ),

( 559, 0, 286 ), ( 559, 43, 264 ), ( 559, 86, 242 ), ( 559, 129, 220 ), ( 559, 172, 198 ), ( 559, 215, 176 ), ( 559, 258, 154 ), ( 559, 301, 132 ), ( 559, 344, 110 ), ( 559, 387, 88 ), ( 559, 430, 66 ), ( 559, 473, 44 ), ( 559, 516, 22 ),

( 602, 0, 308 ), ( 602, 43, 286 ), ( 602, 86, 264 ), ( 602, 129, 242 ), ( 602, 172, 220 ), ( 602, 215, 198 ), ( 602, 258, 176 ), ( 602, 301, 154 ), ( 602, 344, 132 ), ( 602, 387, 110 ), ( 602, 430, 88 ), ( 602, 473, 66 ), ( 602, 516, 44 ), ( 602, 559, 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)