Question 1176880
.
Recall the one-to-one and onto mapping of the set of natural numbers to the set of integers. We used this mapping to show that the integers were countably infinite. Find a function, f(n) that gives the nth integer of the given mapping below. You may find it useful to know that the floor(x) of a number is the largest integer that is less than or equal to x. You may use the floor in your final answer.

Examples: floor(4.3) = 4

          floor(10.789) = 10

          floor(8) = 8

          floor(-2.6) = -3

Mapping:

N   Z
1   0
2   1
3   -1
4   2
5   -2
6   3
7   -3
~~~~~~~~~~~~~~~~~~~~~~~~~~



<pre>
Use this function

    f: N  --->  Z   from natural numbers (= positive integers) to all integers
  
    f(1) = 0,

    f(n) = {{{(-1)^n}}} * {{{floor(n/2))}}},  n > = 2.


It maps


      n      1    2    3    4    5    6    7    8    9. . . . 

    f(n)     0    1   -1    2   -2    3   -3    4   -4 . . . 


and so on.
</pre>

Solved.