For integers $a_1,\dots,a_n \geq 2$, let $[a_1,\dots,a_n]$ denote the 'negative' continued fraction $$[a_1,\dots,a_n]=a_1-\dfrac{1}{a_2-\dfrac{1}{\cdots -\dfrac{1}{a_n}}}.$$
We would have $[a_1,\dots,a_n]=\frac{p}{q}$ with $p,q \in \Bbb Z$ relatively prime and $p>q>0$. Let us denote $p$ by $p(a_1,\dots,a_n)$. Then we can consider $n!$ numbers given by $p(a_{\sigma(1)},\dots,a_{\sigma(n)})$ for $\sigma \in S_n$.
For example, we have $p(2,3,4)=18, p(2,4,3)=19, p(3,2,4)=17, p(3,4,2)=19, p(4,2,3)=17, p(4,3,2)=18$.
What I am curious is: if we have $a_1,\dots,a_n\geq 2$, is there a way to compute $\max_{\sigma \in S_n} p(a_{\sigma(1)},\dots,a_{\sigma(n)})$? I tried some simple cases as above, but I couldn't find any patterns
Let me reorder the indexing of the $a_i$ so that $$r_n=[a_n,\dots,a_1]=a_n-\dfrac{1}{a_{n-1}-\dfrac{1}{\cdots -\dfrac{1}{a_1}}}$$ Then if we consider the $a_i$ to be fixed, we can define $$\begin{align}r_1 &= a_1\\r_k &= a_k - \dfrac 1{r_{k-1}}, \quad k > 1\end{align}$$
If we then let $r_k = \frac{p_k}{q_k}$ where $p_k$ and $q_k$ are co-prime for all $k$, then $$\begin{align}\dfrac{p_k}{q_k} &= a_k - \dfrac{q_{k-1}}{p_{k-1}}\\p_k &= a_kq_k- \dfrac{q_kq_{k-1}}{p_{k-1}}\end{align}$$ From the latter equation we get $p_{k-1}\mid q_kq_{k-1}$, but since $p_{k-1}$ is co-prime to $q_{k-1}$, this means $p_{k-1}\mid q_k$. But then $\frac{q_k}{p_{k-1}}$ divides $q_k$ and thus by the equation also divides $p_k$, so it can only be $1$. That is, $q_k = p_{k-1}$ and
$$p_k = a_kp_{k-1} - p_{k-2}, k \ge 2$$ where we define $p_0 = 1$.
This means that the $p_k$ are certain fixed polynomials in the $a_i$. The first few are $$\begin{align} p_0 &= 1\\ p_1 &= a_1\\ p_2 &= a_2a_1 - 1\\ p_3 &= a_3a_2a_1 - a_3 - a_1\\ p_4 &= a_4a_3a_2a_1 - a_4a_3 - a_4a_1 - a_2a_1 + 1\\ &\ \ \vdots\end{align}$$
So finding the arrangement of the values $a_i$ that maximizes $p_n$ is going to require maximizing the corresponding polynomial. You can figure out specific cases fairly easily, but I don't have a full solution. It looks like reversing the $a_i$ (i.e., $a_i \to a_{n+1-i}$) does not change the value of $p_n$, though I have not checked if that is always true. For $n \le 2$, the value does not depend on order. For $p_3$, clearly $a_2$ should be the largest of the three, while the order of $a_1, a_3$ does not matter. For $p_4$, you need to minimize $a_4a_3+a_4a_1 + a_2a_1$, which can be done by choosing $a_2 \ge a_3 \ge a_4\ge a_1$.