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

( 22, 0, 5 ),

( 44, 0, 10 ), ( 44, 22, 5 ),

( 66, 0, 15 ), ( 66, 22, 10 ), ( 66, 44, 5 ),

( 88, 0, 20 ), ( 88, 22, 15 ), ( 88, 44, 10 ), ( 88, 66, 5 ),

( 110, 0, 25 ), ( 110, 22, 20 ), ( 110, 44, 15 ), ( 110, 66, 10 ), ( 110, 88, 5 ),

( 132, 0, 30 ), ( 132, 22, 25 ), ( 132, 44, 20 ), ( 132, 66, 15 ), ( 132, 88, 10 ), ( 132, 110, 5 ),

( 154, 0, 35 ), ( 154, 22, 30 ), ( 154, 44, 25 ), ( 154, 66, 20 ), ( 154, 88, 15 ), ( 154, 110, 10 ), ( 154, 132, 5 ),

( 176, 0, 40 ), ( 176, 22, 35 ), ( 176, 44, 30 ), ( 176, 66, 25 ), ( 176, 88, 20 ), ( 176, 110, 15 ), ( 176, 132, 10 ), ( 176, 154, 5 ),

( 198, 0, 45 ), ( 198, 22, 40 ), ( 198, 44, 35 ), ( 198, 66, 30 ), ( 198, 88, 25 ), ( 198, 110, 20 ), ( 198, 132, 15 ), ( 198, 154, 10 ), ( 198, 176, 5 ),

( 220, 0, 50 ), ( 220, 22, 45 ), ( 220, 44, 40 ), ( 220, 66, 35 ), ( 220, 88, 30 ), ( 220, 110, 25 ), ( 220, 132, 20 ), ( 220, 154, 15 ), ( 220, 176, 10 ), ( 220, 198, 5 ),

( 242, 0, 55 ), ( 242, 22, 50 ), ( 242, 44, 45 ), ( 242, 66, 40 ), ( 242, 88, 35 ), ( 242, 110, 30 ), ( 242, 132, 25 ), ( 242, 154, 20 ), ( 242, 176, 15 ), ( 242, 198, 10 ), ( 242, 220, 5 ),

( 264, 0, 60 ), ( 264, 22, 55 ), ( 264, 44, 50 ), ( 264, 66, 45 ), ( 264, 88, 40 ), ( 264, 110, 35 ), ( 264, 132, 30 ), ( 264, 154, 25 ), ( 264, 176, 20 ), ( 264, 198, 15 ), ( 264, 220, 10 ), ( 264, 242, 5 ),

( 286, 0, 65 ), ( 286, 22, 60 ), ( 286, 44, 55 ), ( 286, 66, 50 ), ( 286, 88, 45 ), ( 286, 110, 40 ), ( 286, 132, 35 ), ( 286, 154, 30 ), ( 286, 176, 25 ), ( 286, 198, 20 ), ( 286, 220, 15 ), ( 286, 242, 10 ), ( 286, 264, 5 ),

( 308, 0, 70 ), ( 308, 22, 65 ), ( 308, 44, 60 ), ( 308, 66, 55 ), ( 308, 88, 50 ), ( 308, 110, 45 ), ( 308, 132, 40 ), ( 308, 154, 35 ), ( 308, 176, 30 ), ( 308, 198, 25 ), ( 308, 220, 20 ), ( 308, 242, 15 ), ( 308, 264, 10 ), ( 308, 286, 5 ),

...

}

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)