Continued fraction
= Continued fraction
{wiki}
A simple <continued fraction> writes a <real number> as $[a_0;a_1,a_2,\ldots]=a_0+1/(a_1+1/(a_2+\cdots))$, with integral $a_0$ and positive integral $a_i$ for $i\ge1$. Repeatedly taking the <integer> part and inverting the remainder constructs the expansion.
For example, $17/7=[2;2,3]$. Rational inputs terminate; irrational inputs give infinite expansions. Truncations are <continued fraction convergents>, whose numerator and denominator satisfy short recurrences and provide particularly effective <best rational approximations>. The expansion of a <quadratic irrational number> is eventually periodic, linking these approximations with <Pell equations>.