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

44/3 = (44-0)/3 = {

( 44, 0, 3 ),

( 88, 0, 6 ), ( 88, 44, 3 ),

( 132, 0, 9 ), ( 132, 44, 6 ), ( 132, 88, 3 ),

( 176, 0, 12 ), ( 176, 44, 9 ), ( 176, 88, 6 ), ( 176, 132, 3 ),

( 220, 0, 15 ), ( 220, 44, 12 ), ( 220, 88, 9 ), ( 220, 132, 6 ), ( 220, 176, 3 ),

( 264, 0, 18 ), ( 264, 44, 15 ), ( 264, 88, 12 ), ( 264, 132, 9 ), ( 264, 176, 6 ), ( 264, 220, 3 ),

( 308, 0, 21 ), ( 308, 44, 18 ), ( 308, 88, 15 ), ( 308, 132, 12 ), ( 308, 176, 9 ), ( 308, 220, 6 ), ( 308, 264, 3 ),

( 352, 0, 24 ), ( 352, 44, 21 ), ( 352, 88, 18 ), ( 352, 132, 15 ), ( 352, 176, 12 ), ( 352, 220, 9 ), ( 352, 264, 6 ), ( 352, 308, 3 ),

( 396, 0, 27 ), ( 396, 44, 24 ), ( 396, 88, 21 ), ( 396, 132, 18 ), ( 396, 176, 15 ), ( 396, 220, 12 ), ( 396, 264, 9 ), ( 396, 308, 6 ), ( 396, 352, 3 ),

( 440, 0, 30 ), ( 440, 44, 27 ), ( 440, 88, 24 ), ( 440, 132, 21 ), ( 440, 176, 18 ), ( 440, 220, 15 ), ( 440, 264, 12 ), ( 440, 308, 9 ), ( 440, 352, 6 ), ( 440, 396, 3 ),

( 484, 0, 33 ), ( 484, 44, 30 ), ( 484, 88, 27 ), ( 484, 132, 24 ), ( 484, 176, 21 ), ( 484, 220, 18 ), ( 484, 264, 15 ), ( 484, 308, 12 ), ( 484, 352, 9 ), ( 484, 396, 6 ), ( 484, 440, 3 ),

( 528, 0, 36 ), ( 528, 44, 33 ), ( 528, 88, 30 ), ( 528, 132, 27 ), ( 528, 176, 24 ), ( 528, 220, 21 ), ( 528, 264, 18 ), ( 528, 308, 15 ), ( 528, 352, 12 ), ( 528, 396, 9 ), ( 528, 440, 6 ), ( 528, 484, 3 ),

( 572, 0, 39 ), ( 572, 44, 36 ), ( 572, 88, 33 ), ( 572, 132, 30 ), ( 572, 176, 27 ), ( 572, 220, 24 ), ( 572, 264, 21 ), ( 572, 308, 18 ), ( 572, 352, 15 ), ( 572, 396, 12 ), ( 572, 440, 9 ), ( 572, 484, 6 ), ( 572, 528, 3 ),

( 616, 0, 42 ), ( 616, 44, 39 ), ( 616, 88, 36 ), ( 616, 132, 33 ), ( 616, 176, 30 ), ( 616, 220, 27 ), ( 616, 264, 24 ), ( 616, 308, 21 ), ( 616, 352, 18 ), ( 616, 396, 15 ), ( 616, 440, 12 ), ( 616, 484, 9 ), ( 616, 528, 6 ), ( 616, 572, 3 ),

...

}

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)