The context, from Enumerating the Rationals:
My favourite enumeration of the (non-negative) rationals was discovered by Moshe Newman, and is a simple recurrence relation. More specifically, it is a very basic function f such that the sequence {0, f(0), f(f(0)), f(f(f(0))), …} contains each non-negative rational precisely once.
$f(x) = \dfrac{1}{2 \lfloor x \rfloor - x + 1}$
If you’re not amazed by this, you should be. It generates the sequence {0/1, 1/1, 1/2, 2/1, 1/3, 3/2, 2/3, 3/1, 1/4, 4/3, 3/5, 5/2, 2/5, 5/3, …}, which can be proved to hit every non-negative rational exactly once...
How does this work? I am not familiar with the use of the left and right floor symbols and can't find an explanation online.
EDIT
Alternatively we could recursively define the sequence of rational numbers $q: \mathbb{N}\to \mathbb{Q}$ such that:
$q(0) = 0/1$
$\forall x \in \mathbb{N}:[q(x+1) = \dfrac{1}{2 \lfloor q(x) \rfloor - q(x) + 1}]$
Then we would have:
$q(0) = 0/1$
$q(1) = 1/1$
$q(2) = 1/2$
$q(3) = 2/1$
$q(4) = 1/3$
$\vdots$