From this question, I learned that the square root of a number $n$ can be written as a continued fraction of the form:
$$\sqrt n=a+\frac{n-a^2}{a+\sqrt n}$$
where $a$ can have any value. By jumping to conclusions and testing, I believe that the optimal value for $a$ for a rapid convergence is the largest integer such that $a^2 < n$, but I haven't even been able to start trying to prove this.
Any insight would be helpful. Thanks!
There are two basic methods. The one usually called continued fractions starts with $a^2 < n,$ and continues with all $+$ signs. The other side would be the fairly modern method of Zagier, which uses all minus signs, and is discussed at length in his book on zeta functions, see also
https://oeis.org/A257161
The usual method is due, as far as I can tell, to Lagrange and Gauss; I admit that it is possible that continued fractions existed before the right-neighbor method. Here are some examples.
This one says that the CF for $\sqrt 7$ is $\langle 2; 1,1,1,4 \rangle,$ where the $1,1,1,4$ keeps repeating.
This one says that the CF for $\sqrt {29}$ is $\langle 5;2,1,1,2,10 \rangle,$ where the $2,1,1,2,10$ keeps repeating. In this case that part is repeated in the Lagrange cycle, which happens because there is a solution to $u^2 - 29 v^2 = -1$ in integers.