Index satisfying tuples lexicographically for integers $0<a<b<c$ with rational $\sqrt{\frac{c-a}{c+b}},\sqrt{\frac{c+a}{c-b}}$?

60 Views Asked by At

Related to the question about Triples of positive integers $a,b,c$ with rational $\sqrt{\frac{c-a}{c+b}},\sqrt{\frac{c+a}{c-b}}$?, I'm interested in whether there is a way to get satisfying tuples $\left(a,b,c\right)$ in lexicographical order by an index.

The sequence is easily enumerable through iteration: $$ \left\{ \begin{align} &\left(a,b,c\right)\\ &: c \in [1, \cdots, \infty] \land b \in [1, \cdots, c-1] \land a \in [1, \cdots, b-1] \\ &\mid \, \left( \sqrt{\frac{c-a}{c+b}} \in \mathbb{Q} \right) \land \left( \sqrt{\frac{c+a}{c-b}} \in \mathbb{Q} \right) \end{align} \right\} $$

but if you want the 1 billionth tuple, that is a lot of I-think-probably unnecessary work. Is there a way to directly calculate a tuple given an index into the lexicographically-sorted sequence?


Edit: Working on this some myself, I realized that it would probably be far easier to index the tuples by lexicographical order if we used $\left(c,b,a\right)$, since $c > b > a > 0$. This would be fine also.


Edit2: Just to reiterate (from the other thread) something I've found helpful, writing the equations as: $$ \left\{\begin{align} q \times r^2 &= (c-a)\\ q \times s^2 &= (c+b)\\ t \times u^2 &= (c+a)\\ t \times v^2 &= (c-b) \end{align}\right.\\ $$ where $$ \begin{align} \{a, b, c\} &\in \mathbb{Z}\,\land\,(0<a<b<c)\\ \{q, t\} &\in \mathbb{Z}\\ \left\{\frac{r}{s}, \frac{u}{v}\right\} &\in \mathbb{Q} \end{align} $$ makes it explicit that the individual numerators and denominators need not be squares, only the quotients (so there can be a common non-square term that cancels between a numerator and denominator).