previous up next
Go backward to Example
Go up to Top
Go forward to Example
RISC-Linz logo

Example (Continued)

From f, we remove all "doubles" constructing a sequence f': N -> Q that contains each positive rational number in exactly one position.

Finally we can define an enumeration of all rationals

g: N ->bijective Q
g(x) :=
   if x = 0 then 0
   else if x is even
      then -f'(x/2)
      else f'((x-1)/2)
g = [0, 1, -1, 1/2, -1/2, 2/1, -2/1, 1/3, -1/3, 3/1, -3/1, ...].

Author: Wolfgang Schreiner
Last Modification: December 7, 1999

previous up next