Wanted to record some observations here...
If we consider the sequence
- $p = a_1 q + r_1$
- $p = a_2(q-r_1) + r_2$
- $p = a_3(q-r_1-r_2) + r_3$
- etc.
and try to solve for the remainders in the form $r_i = c_i p - d_i q$, there is a nice recursive relation:
First, $c_1 = 1$ and $d_1 = a_1$, and in general,
$c_j = 1 + a_j (c_1 + \ldots + c_{j-1})$ and
$d_j = (1+a_1)(1+a_2)\cdots (1+a_{j-1})a_j$
We can also write $c_j(1+a_j) = c_1 + \ldots + c_j$ so that
$c_j = 1 + \frac{a_j}{a_{j-1}}(c_{j-1} (1+a_{j-1})-1)$. This can be expanded further to obtain the form
$c_j = 1 + a_j [ 1 + (1+a_{j-1}) [ 1 + (1+a_{j-2}) [ 1 + \ldots [1 + (1+a_2)]]\ldots]$, or even
$c_j = 1+a_j + a_j(1+a_{j-1}) + a_j(1+a_{j-1})(1+a_{j-2}) + \ldots + a_j(1+a_{j-1})(1+a_{j-2})\cdots(1+a_2)$
Note that the $a_i$ are strictly increasing in the sequence. Suppose the procedure terminates at the $n$-th step (when $r_n=0$). The limit is then $p/a_n$, and $0 = r_n = c_n (p/q) - d_n$ or that $p/q = d_n / c_n$.
I still don't have a closed form expression, but for instance:
For rationals $p/q$ for which the sequence terminates in the first step, $0 = r_1 = c_1 (p/q) - d_1 = p/q - a_1$, so that $q$ is a divisor of $p$, and the limit is $p/q$.
For termination at the second step, $0 = r_2 = c_2 (p/q) - d_2 = (1+a_2)(p/q) - (1+a_1)a_2$, or that $\frac{p}{q} = \frac{(1+a_1)a_2}{1+a_2}$. If there exists $a_1 < a_2$ satisfying this equality, then the sequence terminates in the second step. One such criteria is if $d$ is a divisor of $p$, $q = d+1$ and $p/d - 1 < d$, then the sequence terminates in the second step to $p/d = (1+a_1)$.
For examples: $30/7 = (1+4)6/(1+6)$. Also, $30/4 = 120/16 = (1+7)15/(1+15)$.
Third step termination: $\frac{p}{q} = \frac{ (1+a_1)(1+a_2)a_3 }{ 1 + a_3(1+(1+a_2)) }$, limit is $(1+a_1)(1+a_2)$, and etc.
Also, it appears that if you plug in $a_n = d$ in any formula, you can generate for which $p$ the process converges to $d$ by substituting any $a_1 < a_2 < \ldots < a_{n-1} < d$. Maybe there's more special structure...
It never hurts to look at some data. Calculate the first few terms:
$$2,5,\frac72,\frac{17}4,\frac{31}8,\frac{65}{16},\frac{127}{32}$$
We can even fit the first two numbers into the apparent pattern:
$$\frac1{1/2},\frac51,\frac72,\frac{17}4,\frac{31}8,\frac{65}{16},\frac{127}{32}$$
The denominator of $a(n)$ appears to be $2^{n-2}$, and the numerators are alternately one less and one more than a power of $2$. Specifically, it appears that the numerator of $a(n)$ is $2^n-1$ when $n$ is odd and $2^n+1$ when $n$ is even or, more simply, $2^n+(-1)^n$. We conjecture, therefore, that
$$a(n)=\frac{2^n+(-1)^n}{2^{n-2}}\;.$$
Now prove this by induction on $n$, and observe that it’s now trivial to calculate the limit of the sequence.
Best Answer
It is convenient to represent every $q_n$ as a reduced fraction $\frac{a_n}{b_n}$. So $a_0=b_0=1$ and:
$$ \frac{a_{n+1}}{b_{n+1}} = \frac{\frac{a_n}{b_n}+2}{\frac{a_n}{b_n}+1}=\frac{a_n+2 b_n}{a_n+b_n}\tag{1}$$ or: $$ \left(\begin{array}{c}a_{n+1}\\b_{n+1}\end{array}\right)=\left(\begin{array}{cc}1 & 2\\ 1 & 1\end{array}\right)\left(\begin{array}{c}a_{n}\\b_{n}\end{array}\right).\tag{2}$$ The eigenvalues of such a matrix are $1\pm\sqrt{2}$ and the eigenvectors are $ \left(\begin{array}{c}\pm\sqrt{2}\\1\end{array}\right)$.
Since $a_n,b_n>0$, $\lim_{n\to +\infty}\frac{a_n}{b_n}=\sqrt{2}$ follows.