Determine convergents for square root All square roots can be represented as a continued fraction.
The fraction can be calculated to $n$ terms (e.g. $\sqrt{2}$ is $[1; 2, 2, 2, 2...]$)
So the continued fraction for $\sqrt{2}$ to $3$ terms would be 
$$1 + \frac{1}{2 + \frac{1}{2 + \frac{1}{2 + 1}}}  = \frac{17}{12}.$$ 
Additionally, the next convergent for square root of $2$ can be calculated with the formula $$\frac{numerator + 2 * denominator}{numerator + denominator}$$
How would I find the simplified continued fraction to $Y$ terms for the square root of $N$? So $f(2, 3)$ would be $\frac{17}{12}$.  
If a similar formula to calculating the next convergent of $\sqrt{2}$ exists for all square roots, please include that formula.
 A: This tutorial site on continued fractions presents a generalized means of calculating the successive convergents for a continued fraction from left to right, each in terms of the numerator and denominators of the previous convergent:
If our continued fraction is [a0; a1, a2, ..., ] then the successive convergents are available (defining N-1 ≡ 1 and D-1 ≡ 0) as:


*C0 ≡ N0 / D0 = a0 / 1 = a0;


*C1 ≡ N1 / D1 = (a1⋅N0 + N-1) / (a1⋅D0 + D-1) = (a1⋅a0 + 1) / (a1⋅c + 0)
    :
    n. Cn ≡ Nn / Dn = (an⋅Nn-1 + Nn-2) / (an⋅Dn-1 + Dn-2)
For your example of $$\sqrt{2} = [1; (2)]$$ one obtains in succession:


*a0=1; C0 ≡ 1 / 1 = 1;


*a1=2; C1 ≡ (2.1 + 1) / (2.1 + 0) = 3 / 2;


*a2=2; C2 ≡ (2.3 + 1) / (2.2 + 1) = 7 / 5;


*a3=2; C3 ≡ (2.7 + 3) / (2.5 + 2) = 17 / 12;


*a4=2; C4 ≡ (2.17 + 7) / (2.12 + 5) = 41 / 29.
Likewise for $$\sqrt{15} = [3; (1, 6)]$$


*a0=3; C0 ≡ 3 / 1 = 3;


*a1=1; C1 ≡ (1.3 + 1) / (1.1 + 0) = 4 / 1;


*a2=6; C2 ≡ (6.4 + 3) / (6.1 + 1) = 27 / 7;


*a3=1; C3 ≡ (1.27 + 4) / (1.7 + 1) = 31 / 8;


*a4=6; C4 ≡ (6.31 + 27) / (6.8 + 7) = 213 / 55.
A: I think you can construct something form 
$$\sqrt{a}=1+\sqrt{a}-1=1+\frac{(\sqrt{a}-1)(\sqrt{a}+1)}{1\cdot(\sqrt{a}+1)}$$
$$=1+\frac{a-1}{1+\sqrt{a}}$$
This equation is self referential. So if you plug in the the expression on the right hand side of the equation for $\sqrt{a}$ in the denominator you get.
$$\sqrt{a}=1+\frac{a-1}{1+[1+\frac{a-1}{1+\sqrt{a}}]}=1+\frac{a-1}{2+\frac{a-1}{1+\sqrt{a}}}$$
Now you can repeat this as long as you wish. I hope that was what you were asking for.
And there is a way of directly getting the convergents. Euler did this in a paper.
