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

( 44, 0, 7 ),

( 88, 0, 14 ), ( 88, 44, 7 ),

( 132, 0, 21 ), ( 132, 44, 14 ), ( 132, 88, 7 ),

( 176, 0, 28 ), ( 176, 44, 21 ), ( 176, 88, 14 ), ( 176, 132, 7 ),

( 220, 0, 35 ), ( 220, 44, 28 ), ( 220, 88, 21 ), ( 220, 132, 14 ), ( 220, 176, 7 ),

( 264, 0, 42 ), ( 264, 44, 35 ), ( 264, 88, 28 ), ( 264, 132, 21 ), ( 264, 176, 14 ), ( 264, 220, 7 ),

( 308, 0, 49 ), ( 308, 44, 42 ), ( 308, 88, 35 ), ( 308, 132, 28 ), ( 308, 176, 21 ), ( 308, 220, 14 ), ( 308, 264, 7 ),

( 352, 0, 56 ), ( 352, 44, 49 ), ( 352, 88, 42 ), ( 352, 132, 35 ), ( 352, 176, 28 ), ( 352, 220, 21 ), ( 352, 264, 14 ), ( 352, 308, 7 ),

( 396, 0, 63 ), ( 396, 44, 56 ), ( 396, 88, 49 ), ( 396, 132, 42 ), ( 396, 176, 35 ), ( 396, 220, 28 ), ( 396, 264, 21 ), ( 396, 308, 14 ), ( 396, 352, 7 ),

( 440, 0, 70 ), ( 440, 44, 63 ), ( 440, 88, 56 ), ( 440, 132, 49 ), ( 440, 176, 42 ), ( 440, 220, 35 ), ( 440, 264, 28 ), ( 440, 308, 21 ), ( 440, 352, 14 ), ( 440, 396, 7 ),

( 484, 0, 77 ), ( 484, 44, 70 ), ( 484, 88, 63 ), ( 484, 132, 56 ), ( 484, 176, 49 ), ( 484, 220, 42 ), ( 484, 264, 35 ), ( 484, 308, 28 ), ( 484, 352, 21 ), ( 484, 396, 14 ), ( 484, 440, 7 ),

( 528, 0, 84 ), ( 528, 44, 77 ), ( 528, 88, 70 ), ( 528, 132, 63 ), ( 528, 176, 56 ), ( 528, 220, 49 ), ( 528, 264, 42 ), ( 528, 308, 35 ), ( 528, 352, 28 ), ( 528, 396, 21 ), ( 528, 440, 14 ), ( 528, 484, 7 ),

( 572, 0, 91 ), ( 572, 44, 84 ), ( 572, 88, 77 ), ( 572, 132, 70 ), ( 572, 176, 63 ), ( 572, 220, 56 ), ( 572, 264, 49 ), ( 572, 308, 42 ), ( 572, 352, 35 ), ( 572, 396, 28 ), ( 572, 440, 21 ), ( 572, 484, 14 ), ( 572, 528, 7 ),

( 616, 0, 98 ), ( 616, 44, 91 ), ( 616, 88, 84 ), ( 616, 132, 77 ), ( 616, 176, 70 ), ( 616, 220, 63 ), ( 616, 264, 56 ), ( 616, 308, 49 ), ( 616, 352, 42 ), ( 616, 396, 35 ), ( 616, 440, 28 ), ( 616, 484, 21 ), ( 616, 528, 14 ), ( 616, 572, 7 ),

...

}

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)