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

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

( 41, 0, 7 ),

( 82, 0, 14 ), ( 82, 41, 7 ),

( 123, 0, 21 ), ( 123, 41, 14 ), ( 123, 82, 7 ),

( 164, 0, 28 ), ( 164, 41, 21 ), ( 164, 82, 14 ), ( 164, 123, 7 ),

( 205, 0, 35 ), ( 205, 41, 28 ), ( 205, 82, 21 ), ( 205, 123, 14 ), ( 205, 164, 7 ),

( 246, 0, 42 ), ( 246, 41, 35 ), ( 246, 82, 28 ), ( 246, 123, 21 ), ( 246, 164, 14 ), ( 246, 205, 7 ),

( 287, 0, 49 ), ( 287, 41, 42 ), ( 287, 82, 35 ), ( 287, 123, 28 ), ( 287, 164, 21 ), ( 287, 205, 14 ), ( 287, 246, 7 ),

( 328, 0, 56 ), ( 328, 41, 49 ), ( 328, 82, 42 ), ( 328, 123, 35 ), ( 328, 164, 28 ), ( 328, 205, 21 ), ( 328, 246, 14 ), ( 328, 287, 7 ),

( 369, 0, 63 ), ( 369, 41, 56 ), ( 369, 82, 49 ), ( 369, 123, 42 ), ( 369, 164, 35 ), ( 369, 205, 28 ), ( 369, 246, 21 ), ( 369, 287, 14 ), ( 369, 328, 7 ),

( 410, 0, 70 ), ( 410, 41, 63 ), ( 410, 82, 56 ), ( 410, 123, 49 ), ( 410, 164, 42 ), ( 410, 205, 35 ), ( 410, 246, 28 ), ( 410, 287, 21 ), ( 410, 328, 14 ), ( 410, 369, 7 ),

( 451, 0, 77 ), ( 451, 41, 70 ), ( 451, 82, 63 ), ( 451, 123, 56 ), ( 451, 164, 49 ), ( 451, 205, 42 ), ( 451, 246, 35 ), ( 451, 287, 28 ), ( 451, 328, 21 ), ( 451, 369, 14 ), ( 451, 410, 7 ),

( 492, 0, 84 ), ( 492, 41, 77 ), ( 492, 82, 70 ), ( 492, 123, 63 ), ( 492, 164, 56 ), ( 492, 205, 49 ), ( 492, 246, 42 ), ( 492, 287, 35 ), ( 492, 328, 28 ), ( 492, 369, 21 ), ( 492, 410, 14 ), ( 492, 451, 7 ),

( 533, 0, 91 ), ( 533, 41, 84 ), ( 533, 82, 77 ), ( 533, 123, 70 ), ( 533, 164, 63 ), ( 533, 205, 56 ), ( 533, 246, 49 ), ( 533, 287, 42 ), ( 533, 328, 35 ), ( 533, 369, 28 ), ( 533, 410, 21 ), ( 533, 451, 14 ), ( 533, 492, 7 ),

( 574, 0, 98 ), ( 574, 41, 91 ), ( 574, 82, 84 ), ( 574, 123, 77 ), ( 574, 164, 70 ), ( 574, 205, 63 ), ( 574, 246, 56 ), ( 574, 287, 49 ), ( 574, 328, 42 ), ( 574, 369, 35 ), ( 574, 410, 28 ), ( 574, 451, 21 ), ( 574, 492, 14 ), ( 574, 533, 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)