Build a bijection $\mathbb{R} \to \mathbb{R}\setminus \mathbb{N}$

This question already has an answer here:

  • Find a bijection from $\mathbb R$ to $\mathbb R-\mathbb N$

    6 answers

Solutions Collecting From Web of "Build a bijection $\mathbb{R} \to \mathbb{R}\setminus \mathbb{N}$"

Map $\mathbb{Z}$ bijectively to $\{…,-3,-2,-1,0\}$ and leave the other points from $\mathbb{R}$ untouched.

Hint: do you know how to build a bijection $[0,1]\to (0,1]$? You “hide” $0$ somewhere inside an interval (in some infinite sequence). In your case you can hide all positive integers in some sequence too.

Update: you can choose any sequence $\{a_i\}$ and for all $n\in\mathbb{N} \quad f(n) = a_{2n},$ for elements from sequence $f(a_i) = a_{2i+1},$ and otherwise $f(x) = x$.