Bijection from ordered pairs of $[0,n]$ I am looking for a simple expression to convert ordered pairs from  $[0,n]$ to the first smallest subset of $\mathbb N$.
For example if $n = 3$:
$$ (0, 1) \rightarrow 0$$
$$ (0, 2) \rightarrow 1$$
$$ (0, 3) \rightarrow 2$$
$$ (1, 2) \rightarrow 3$$
$$ (1, 3) \rightarrow 4$$
$$ (2, 3) \rightarrow 5$$
What could be an explicit formula for that?
To rephrase, I am looking for a formula $f_n(i, j)$ where $0 \le i < j \le n$ such that $0 \le f_n(i, j) < \left ( ^{n}_{2}\right )$ and $f_n$ is bijective. I would also like if possible the inverse bijection to retrieve $i$ and $j$ from an image of $f_n$.
The values of the function do not matter as long as the set of values is the same.
Cantor pairing functions are not applicable here because the bijection is not infinite.

You can create a bijection from your set of pairs $\{(i,j)\in \mathbb N^2|\,0\leq i<j\leq n\}$ to $\{(i,)\in\mathbb N^2|\,0\leq i\leq n-1,\, 0\leq j\leq n-1-i\}$, which are the first $n$ diagonals of the cantor pairing function, with $f:(i,j)\mapsto(i,j-i-1)$. ($f^{-1}:(i,j)\mapsto(i,i+j+1)$) Then, you can apply the cantor pairing function to $f(i,j)$ to obtain $k$ and retrieve the original $(i,j)$ with $f^{-1}(\pi^{-1}(k))$
