# List of explicit enumerations of rational numbers

A well-known mathematical fact is that the rational numbers are countable, i.e. there is a bijective function

$$f:\mathbb{N}\rightarrow \mathbb{Q}$$

I am interesting in making a list of all explicit such bijections since each one that I know have a different philosophy behind it.

This is one of the more counterintuitive facts about infinite, at least when one enters inside set theory. When I explain this in the first time to anyone, he/she is surprised. Thus I think it will be useful for showing the fact in a more clear manner or as possible exercises to show alternatives ways with respect to the standard one.

#### Solutions Collecting From Web of "List of explicit enumerations of rational numbers"

For an example I like a lot the following one based on the fundamental theorem of arithmetic, which is different from the usual approach using the plane.

Consider the map $T:\mathbb{N}\mapsto \mathbb{Z}$ given by
$$T(n)=(-1)^n\left\lfloor \frac{n+1}{2}\right\rfloor$$
which is a bijection from $\mathbb{N}=\{0,1,\ldots\}$ onto $\mathbb{Z}$. Then the fundamental theorem of arithmetic gives the following nice bijection $R:\mathbb{N}_1\rightarrow \mathbb{Q}_{>0}$ given by
$$R(n)=\prod_{p\text{ prime}}p^{T(\nu_p(n))}\text{,}$$
where $\nu_p$ is the $p$-adic valuation.

Joining this two we can have the desired bijection $f:\mathbb{N}\rightarrow \mathbb{Q}$ given by
$$f(n)=\begin{cases} 0 &\text{if }n=0\\ (-1)^nR(|T(n)|)&\text{if }n\neq 0\\ \end{cases}$$
which can be written as an explicit formula, but gives no new information.