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

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

( 22, 0, 1 ),

( 44, 0, 2 ), ( 44, 22, 1 ),

( 66, 0, 3 ), ( 66, 22, 2 ), ( 66, 44, 1 ),

( 88, 0, 4 ), ( 88, 22, 3 ), ( 88, 44, 2 ), ( 88, 66, 1 ),

( 110, 0, 5 ), ( 110, 22, 4 ), ( 110, 44, 3 ), ( 110, 66, 2 ), ( 110, 88, 1 ),

( 132, 0, 6 ), ( 132, 22, 5 ), ( 132, 44, 4 ), ( 132, 66, 3 ), ( 132, 88, 2 ), ( 132, 110, 1 ),

( 154, 0, 7 ), ( 154, 22, 6 ), ( 154, 44, 5 ), ( 154, 66, 4 ), ( 154, 88, 3 ), ( 154, 110, 2 ), ( 154, 132, 1 ),

( 176, 0, 8 ), ( 176, 22, 7 ), ( 176, 44, 6 ), ( 176, 66, 5 ), ( 176, 88, 4 ), ( 176, 110, 3 ), ( 176, 132, 2 ), ( 176, 154, 1 ),

( 198, 0, 9 ), ( 198, 22, 8 ), ( 198, 44, 7 ), ( 198, 66, 6 ), ( 198, 88, 5 ), ( 198, 110, 4 ), ( 198, 132, 3 ), ( 198, 154, 2 ), ( 198, 176, 1 ),

( 220, 0, 10 ), ( 220, 22, 9 ), ( 220, 44, 8 ), ( 220, 66, 7 ), ( 220, 88, 6 ), ( 220, 110, 5 ), ( 220, 132, 4 ), ( 220, 154, 3 ), ( 220, 176, 2 ), ( 220, 198, 1 ),

( 242, 0, 11 ), ( 242, 22, 10 ), ( 242, 44, 9 ), ( 242, 66, 8 ), ( 242, 88, 7 ), ( 242, 110, 6 ), ( 242, 132, 5 ), ( 242, 154, 4 ), ( 242, 176, 3 ), ( 242, 198, 2 ), ( 242, 220, 1 ),

( 264, 0, 12 ), ( 264, 22, 11 ), ( 264, 44, 10 ), ( 264, 66, 9 ), ( 264, 88, 8 ), ( 264, 110, 7 ), ( 264, 132, 6 ), ( 264, 154, 5 ), ( 264, 176, 4 ), ( 264, 198, 3 ), ( 264, 220, 2 ), ( 264, 242, 1 ),

( 286, 0, 13 ), ( 286, 22, 12 ), ( 286, 44, 11 ), ( 286, 66, 10 ), ( 286, 88, 9 ), ( 286, 110, 8 ), ( 286, 132, 7 ), ( 286, 154, 6 ), ( 286, 176, 5 ), ( 286, 198, 4 ), ( 286, 220, 3 ), ( 286, 242, 2 ), ( 286, 264, 1 ),

( 308, 0, 14 ), ( 308, 22, 13 ), ( 308, 44, 12 ), ( 308, 66, 11 ), ( 308, 88, 10 ), ( 308, 110, 9 ), ( 308, 132, 8 ), ( 308, 154, 7 ), ( 308, 176, 6 ), ( 308, 198, 5 ), ( 308, 220, 4 ), ( 308, 242, 3 ), ( 308, 264, 2 ), ( 308, 286, 1 ),

...

}

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)