TITLE: What is an example of function $f: \Bbb{N} \to \Bbb{Z}$ that is a bijection?
QUESTION [12 upvotes]: Could you give me an example of function $ f \colon \mathbb N \to \mathbb Z$ that is both one-to-one and onto? Does this work: $f(n) := n \times (-1)^n$?
N starts with zero.

REPLY [5 votes]: $$f(n)=(-1)^n \left \lceil \frac{n}{2} \right \rceil$$
where $ \lceil x \rceil $ rounds up a real value (see ceiling function).