computationally efficient linear index to index pair mapping
For a given $m \in Q$, we need to find the biggest $n \in R$, such that $\frac{n(n+1)}{2} \leq m$. Hence, the first element will be $n$ and the second elemnet is $\lfloor m - \frac{n(n+1)}{2} \rfloor$. Now, the question is how can we compute $n$ efficiently? Fortunately, it can be computed by testing some constant numbers and the specified pair will be $(n, \lfloor m - \frac{n(n+1)}{2} \rfloor)$ for a given number $m \in Q$.