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

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

( 41, 0, 20 ),

( 82, 0, 40 ), ( 82, 41, 20 ),

( 123, 0, 60 ), ( 123, 41, 40 ), ( 123, 82, 20 ),

( 164, 0, 80 ), ( 164, 41, 60 ), ( 164, 82, 40 ), ( 164, 123, 20 ),

( 205, 0, 100 ), ( 205, 41, 80 ), ( 205, 82, 60 ), ( 205, 123, 40 ), ( 205, 164, 20 ),

( 246, 0, 120 ), ( 246, 41, 100 ), ( 246, 82, 80 ), ( 246, 123, 60 ), ( 246, 164, 40 ), ( 246, 205, 20 ),

( 287, 0, 140 ), ( 287, 41, 120 ), ( 287, 82, 100 ), ( 287, 123, 80 ), ( 287, 164, 60 ), ( 287, 205, 40 ), ( 287, 246, 20 ),

( 328, 0, 160 ), ( 328, 41, 140 ), ( 328, 82, 120 ), ( 328, 123, 100 ), ( 328, 164, 80 ), ( 328, 205, 60 ), ( 328, 246, 40 ), ( 328, 287, 20 ),

( 369, 0, 180 ), ( 369, 41, 160 ), ( 369, 82, 140 ), ( 369, 123, 120 ), ( 369, 164, 100 ), ( 369, 205, 80 ), ( 369, 246, 60 ), ( 369, 287, 40 ), ( 369, 328, 20 ),

( 410, 0, 200 ), ( 410, 41, 180 ), ( 410, 82, 160 ), ( 410, 123, 140 ), ( 410, 164, 120 ), ( 410, 205, 100 ), ( 410, 246, 80 ), ( 410, 287, 60 ), ( 410, 328, 40 ), ( 410, 369, 20 ),

( 451, 0, 220 ), ( 451, 41, 200 ), ( 451, 82, 180 ), ( 451, 123, 160 ), ( 451, 164, 140 ), ( 451, 205, 120 ), ( 451, 246, 100 ), ( 451, 287, 80 ), ( 451, 328, 60 ), ( 451, 369, 40 ), ( 451, 410, 20 ),

( 492, 0, 240 ), ( 492, 41, 220 ), ( 492, 82, 200 ), ( 492, 123, 180 ), ( 492, 164, 160 ), ( 492, 205, 140 ), ( 492, 246, 120 ), ( 492, 287, 100 ), ( 492, 328, 80 ), ( 492, 369, 60 ), ( 492, 410, 40 ), ( 492, 451, 20 ),

( 533, 0, 260 ), ( 533, 41, 240 ), ( 533, 82, 220 ), ( 533, 123, 200 ), ( 533, 164, 180 ), ( 533, 205, 160 ), ( 533, 246, 140 ), ( 533, 287, 120 ), ( 533, 328, 100 ), ( 533, 369, 80 ), ( 533, 410, 60 ), ( 533, 451, 40 ), ( 533, 492, 20 ),

( 574, 0, 280 ), ( 574, 41, 260 ), ( 574, 82, 240 ), ( 574, 123, 220 ), ( 574, 164, 200 ), ( 574, 205, 180 ), ( 574, 246, 160 ), ( 574, 287, 140 ), ( 574, 328, 120 ), ( 574, 369, 100 ), ( 574, 410, 80 ), ( 574, 451, 60 ), ( 574, 492, 40 ), ( 574, 533, 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)