## Continued Fractions of Square Root

For a nonsquare positive integer $n$, its square root $\sqrt{n}$ can be represented in the form of infinite continued fractions: $\sqrt{n} = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3 + \cfrac{1}{\ddots} } } }$ For convenience we use the notation $\sqrt{n}=[a_0;a_1,a_2,a_3,\ldots]$ for the continued fractions above. In addition, the continued fractions of $\sqrt{n}$ is periodic, i.e. $a_{k+T}=a_k$ where $T$ is the period and $k$ is any positive integer. So the continued fractions of $\sqrt{n}$ is likely written in the form $\sqrt{n} = [a_0; \overline{a_1,a_2,\ldots,a_T}]$ This calculator finds the continued fractions of $\sqrt{n}$ and returns the result in this form but with paranthesis instead of overline in the repeated parts.