{
  "id": "continued-fraction",
  "title": "Continued Fraction",
  "lang": "en",
  "source_lang": "en",
  "summary": "A continued fraction is a nested fractional expression that encodes numbers and functions and provides exceptionally accurate rational approximations.",
  "category": "mathematics",
  "subcategory": "algebra",
  "type": "concept",
  "aliases": [
    "Continued-fraction expansion"
  ],
  "generated_at": "2026-11-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/continued-fraction/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/continued-fraction/",
      "json": "https://aiwiki.page/zh/continued-fraction.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "A continued fraction is an expression formed by repeatedly placing a fraction inside the denominator of another fraction. Its most familiar form represents a real number through a sequence of integer coefficients:\n\n\\[a_0+\\cfrac{1}{a_1+\\cfrac{1}{a_2+\\cfrac{1}{a_3+\\cdots}}}.\\]\n\nTruncating this expression produces rational numbers called convergents. These approximations frequently achieve unusually small errors relative to the sizes of their denominators, making continued fractions a central tool in number theory.\n\nContinued fractions connect the Euclidean algorithm, rational approximation, quadratic equations, and dynamical systems. More general versions, with variable numerators and denominators, represent mathematical functions and support numerical computation. Their theory ranges from exact identities for individual numbers to statistical laws describing the expansions of almost every real number."
    },
    {
      "heading": "Simple continued fractions and their construction",
      "text": "A simple, or regular, continued fraction has the form\n\n\\[[a_0;a_1,a_2,\\ldots] = a_0+\\cfrac{1}{a_1+\\cfrac{1}{a_2+\\cdots}},\\]\n\nwhere \\(a_0\\) is an integer and every subsequent coefficient \\(a_n\\) is a positive integer. The coefficients are called partial quotients. The semicolon separates the initial integer part from the remaining coefficients. A finite expression \\([a_0;a_1,\\ldots,a_n]\\) represents a rational number, whereas an infinite simple continued fraction represents an irrational number.\n\nThe coefficients of a real number \\(x\\) are obtained by taking integer parts and reciprocals. Set \\(x_0=x\\), and define\n\n\\[a_n=\\lfloor x_n\\rfloor,\\qquad x_{n+1}=\\frac{1}{x_n-a_n}\\]\n\nwhenever \\(x_n-a_n\\ne0\\). The numbers \\(x_n\\) are the complete quotients. For an irrational input, the process continues indefinitely. For a rational input, it terminates because it is equivalent to applying the Euclidean algorithm to its numerator and denominator. For example,\n\n\\[\\frac{415}{93} =4+\\frac{43}{93}, \\qquad \\frac{93}{43}=2+\\frac7{43}, \\qquad \\frac{43}{7}=6+\\frac17,\\]\n\nso that\n\n\\[\\frac{415}{93}=[4;2,6,7].\\]\n\nThe partial quotients are precisely the successive division quotients.\n\nEvery irrational real number has exactly one infinite simple continued-fraction expansion. Rational numbers have two finite expansions under the usual convention that all coefficients after the first are positive:\n\n\\[[a_0;\\ldots,a_n] = [a_0;\\ldots,a_n-1,1] \\quad\\text{if }a_n\\ge2.\\]\n\nRequiring the final coefficient to exceed \\(1\\), except for an expansion consisting solely of an integer, selects a canonical representation. Thus \\(3/2=[1;2]=[1;1,1]\\). An integer \\(m\\) likewise has the representations \\([m]\\) and \\([m-1;1]\\). For negative numbers the construction still uses the floor, not truncation toward zero; for example, \\(-3/2=[-2;2]\\).\n\nUnlike positional notation, continued fractions use no fixed base, and their coefficients are not bounded by a fixed digit limit. They record successive reciprocal relationships rather than successive powers of ten or two. Some numbers therefore have strikingly simple expansions that are not apparent from their decimal digits:\n\n\\[\\sqrt2=[1;2,2,2,\\ldots], \\qquad \\frac{1+\\sqrt5}{2}=[1;1,1,1,\\ldots].\\]\n\nThe latter number is the golden ratio. By contrast, simple continued fractions do not generally make addition and multiplication easy: a simple arithmetic operation on two represented numbers can require extensive information about both coefficient sequences."
    },
    {
      "heading": "Convergents, recurrence relations, and convergence",
      "text": "The \\(n\\)th convergent is the finite truncation\n\n\\[\\frac{p_n}{q_n}=[a_0;a_1,\\ldots,a_n].\\]\n\nIts numerator and denominator satisfy the same recurrence relation:\n\n\\[p_n=a_np_{n-1}+p_{n-2}, \\qquad q_n=a_nq_{n-1}+q_{n-2},\\]\n\nwith initial values\n\n\\[p_{-2}=0,\\quad p_{-1}=1,\\qquad q_{-2}=1,\\quad q_{-1}=0.\\]\n\nThese formulas replace repeated evaluation of nested fractions with integer arithmetic. For \\(\\sqrt2\\), they give\n\n\\[1,\\quad \\frac32,\\quad \\frac75,\\quad \\frac{17}{12},\\quad \\frac{41}{29},\\ldots.\\]\n\nThe denominators grow at least as fast as a shifted Fibonacci sequence, since every \\(a_n\\), for \\(n\\ge1\\), is at least \\(1\\).\n\nA useful formulation employs matrices:\n\n\\[\\begin{pmatrix}a_0&1\\\\1&0\\end{pmatrix} \\begin{pmatrix}a_1&1\\\\1&0\\end{pmatrix} \\cdots \\begin{pmatrix}a_n&1\\\\1&0\\end{pmatrix} = \\begin{pmatrix} p_n&p_{n-1}\\\\ q_n&q_{n-1} \\end{pmatrix}.\\]\n\nTaking the determinant gives\n\n\\[p_nq_{n-1}-p_{n-1}q_n=(-1)^{n-1}.\\]\n\nConsequently, each convergent is in lowest terms, and consecutive convergents differ by exactly\n\n\\[\\frac{p_n}{q_n}-\\frac{p_{n-1}}{q_{n-1}} = \\frac{(-1)^{n-1}}{q_nq_{n-1}}.\\]\n\nThe small determinant simultaneously explains coprimality, alternation, and the close spacing of successive approximations.\n\nFor an infinite simple continued fraction, let\n\n\\[\\alpha_{n+1}=[a_{n+1};a_{n+2},\\ldots].\\]\n\nThe original number can then be reconstructed from the convergents and its remaining tail:\n\n\\[x=\\frac{p_n\\alpha_{n+1}+p_{n-1}} {q_n\\alpha_{n+1}+q_{n-1}}.\\]\n\nSubtracting \\(p_n/q_n\\) yields the exact error formula\n\n\\[x-\\frac{p_n}{q_n} = \\frac{(-1)^n} {q_n(q_n\\alpha_{n+1}+q_{n-1})}.\\]\n\nThus the even-indexed convergents lie below \\(x\\), and the odd-indexed ones lie above it. The even subsequence increases and the odd subsequence decreases. Together they provide nested bounds whose widths tend to zero, establishing convergence.\n\nBecause\n\n\\[a_{n+1}<\\alpha_{n+1}<a_{n+1}+1,\\]\n\nthe error satisfies\n\n\\[\\frac{1}{q_n(q_{n+1}+q_n)} < \\left|x-\\frac{p_n}{q_n}\\right| < \\frac{1}{q_nq_{n+1}}.\\]\n\nA particularly useful consequence is\n\n\\[\\left|x-\\frac{p_n}{q_n}\\right| < \\frac{1}{a_{n+1}q_n^2}.\\]\n\nA large next partial quotient therefore signals an especially accurate current convergent. This relationship is more informative than merely counting how many coefficients have been retained: the approximation quality depends strongly on the next coefficient."
    },
    {
      "heading": "Rational approximation and optimality",
      "text": "Diophantine approximation studies how closely real numbers can be approximated by rational numbers while controlling the size of the denominator. Continued fractions provide an explicit answer in one dimension. Their natural error scale is \\(q^{-2}\\): approximations \\(p/q\\) with large denominators can often achieve errors proportional to \\(1/q^2\\), and convergents systematically find such approximations.\n\nA precise optimality statement uses the quantity \\(|qx-p|\\), sometimes called approximation of the second kind. If \\(p_n/q_n\\) is a convergent of an irrational \\(x\\), then, for integers \\(p,q\\) with \\(0<q<q_{n+1}\\),\n\n\\[|qx-p|\\ge |q_nx-p_n|,\\]\n\nwith equality only for the same integer pair \\((p_n,q_n)\\). Thus a convergent minimizes this scaled error until the denominator reaches that of the next convergent. This is not identical to minimizing the ordinary distance \\(|x-p/q|\\); distinguishing the two notions prevents an overly broad interpretation of “best approximation.”\n\nThe intermediate convergents, also called semiconvergents, fill part of the gap between successive convergents. They have the form\n\n\\[\\frac{rp_n+p_{n-1}}{rq_n+q_{n-1}}, \\qquad 1\\le r\\le a_{n+1}.\\]\n\nAt \\(r=a_{n+1}\\), this becomes the next convergent. When the objective is to minimize \\(|x-p/q|\\) subject to a fixed upper bound on \\(q\\), intermediate convergents must also be considered. They are important in practical tasks such as choosing a gear ratio, converting a decimal measurement into a small fraction, or approximating a frequency ratio using bounded integers.\n\nSeveral classical theorems quantify the strength of the approximation. Legendre’s criterion states that if a reduced fraction satisfies\n\n\\[\\left|x-\\frac pq\\right|<\\frac{1}{2q^2},\\]\n\nthen it must be a convergent of \\(x\\). Hurwitz’s theorem states that every irrational \\(x\\) has infinitely many rational approximations satisfying\n\n\\[\\left|x-\\frac pq\\right|<\\frac{1}{\\sqrt5\\,q^2}.\\]\n\nThe constant \\(1/\\sqrt5\\) cannot be replaced by a smaller universal constant. The golden ratio, whose partial quotients are all \\(1\\), supplies the extremal obstruction. Its convergents are ratios of successive Fibonacci numbers.\n\nFor \\pi, the expansion begins\n\n\\[\\pi=[3;7,15,1,292,\\ldots].\\]\n\nIts early convergents include \\(22/7\\), \\(333/106\\), and \\(355/113\\). The coefficient \\(292\\) explains why \\(355/113\\) is exceptionally accurate:\n\n\\[\\left|\\pi-\\frac{355}{113}\\right| \\approx2.67\\times10^{-7}.\\]\n\nMore generally, an irrational number is called badly approximable if there is a constant \\(c>0\\) such that \\(|x-p/q|>c/q^2\\) for every rational \\(p/q\\). This property is equivalent to boundedness of its partial quotients. Continued fractions therefore translate a uniform approximation property into a simple condition on a sequence of integers."
    },
    {
      "heading": "Periodicity, quadratic irrationals, and Pell equations",
      "text": "A quadratic irrational is a real irrational root of a quadratic equation with integer coefficients. Lagrange’s theorem characterizes these numbers exactly: an infinite simple continued fraction is eventually periodic if and only if its value is a quadratic irrational. Periodic notation uses a bar, as in\n\n\\[\\sqrt2=[1;\\overline2], \\qquad \\sqrt{23}=[4;\\overline{1,3,1,8}].\\]\n\n“Eventually periodic” allows a finite initial segment before the repeated block begins.\n\nOne direction follows directly from the algebra of a repeating tail. If\n\n\\[y=[\\overline{b_0,b_1,\\ldots,b_{\\ell-1}}],\\]\n\nthen one traversal of the period expresses \\(y\\) as\n\n\\[y=\\frac{Ay+B}{Cy+D}\\]\n\nfor integers \\(A,B,C,D\\). Rearrangement gives a quadratic equation. The converse is subtler: applying the continued-fraction algorithm to a quadratic irrational generates complete quotients whose algebraic parameters eventually lie in a finite set. A repeated complete quotient then forces repetition of all later coefficients. A sharper result characterizes purely periodic expansions: a real quadratic irrational \\(\\alpha>1\\) is purely periodic precisely when its algebraic conjugate lies between \\(-1\\) and \\(0\\).\n\nFor a positive nonsquare integer \\(D\\), the expansion of \\(\\sqrt D\\) can be generated entirely with integer arithmetic. Starting with\n\n\\[m_0=0,\\quad d_0=1,\\quad a_0=\\lfloor\\sqrt D\\rfloor,\\]\n\nuse\n\n\\[m_{n+1}=d_na_n-m_n,\\]\n\n\\[d_{n+1}=\\frac{D-m_{n+1}^2}{d_n}, \\qquad a_{n+1}= \\left\\lfloor\\frac{a_0+m_{n+1}}{d_{n+1}}\\right\\rfloor.\\]\n\nThe repeating block ends with \\(2a_0\\); the preceding portion of the block is palindromic. This special structure makes square-root expansions particularly effective in integer problems.\n\nThe principal example is Pell’s equation\n\n\\[u^2-Dv^2=1.\\]\n\nLet \\(\\ell\\) be the period length of \\(\\sqrt D\\), and index its convergents beginning at \\(p_0/q_0\\). If \\(\\ell\\) is even, the least positive nontrivial solution is\n\n\\[(u,v)=(p_{\\ell-1},q_{\\ell-1});\\]\n\nif \\(\\ell\\) is odd, it is\n\n\\[(u,v)=(p_{2\\ell-1},q_{2\\ell-1}).\\]\n\nThe equation \\(u^2-Dv^2=-1\\) is solvable in integers exactly when \\(\\ell\\) is odd. For \\(D=2\\), the period has length \\(1\\): \\(1^2-2\\cdot1^2=-1\\), while the next convergent gives \\(3^2-2\\cdot2^2=1\\).\n\nThe smallest solution can be unexpectedly large. For \\(D=61\\), it is\n\n\\[u=1766319049,\\qquad v=226153980.\\]\n\nOnce a fundamental solution is known, further positive solutions arise from powers of \\(u+v\\sqrt D\\). The recurrence is therefore connected with multiplication in quadratic number fields. The finite periodic expansion provides access to an infinite family of integer solutions whose first member may already be far beyond a direct search."
    },
    {
      "heading": "Generalized continued fractions and function theory",
      "text": "A generalized continued fraction permits arbitrary partial numerators and denominators:\n\n\\[b_0+\\cfrac{a_1}{b_1+\\cfrac{a_2}{b_2+\\cfrac{a_3}{b_3+\\cdots}}}.\\]\n\nThe coefficients can be real or complex numbers, or functions of a variable. Simple continued fractions are the special case in which every partial numerator equals \\(1\\) and the partial denominators satisfy the integer restrictions. This broader class is important in analysis because many functions admit useful continued-fraction representations even when their simple continued fractions show no accessible pattern.\n\nThe generalized convergents \\(A_n/B_n\\) obey\n\n\\[A_n=b_nA_{n-1}+a_nA_{n-2}, \\qquad B_n=b_nB_{n-1}+a_nB_{n-2},\\]\n\nwith\n\n\\[A_{-1}=1,\\quad A_0=b_0,\\qquad B_{-1}=0,\\quad B_0=1.\\]\n\nTheir determinant identity becomes\n\n\\[A_nB_{n-1}-A_{n-1}B_n = (-1)^{n-1}\\prod_{k=1}^{n}a_k.\\]\n\nUnlike the simple positive case, however, convergence is not automatic. Signs, complex phases, vanishing denominators, and coefficient growth can all matter. Worpitzky’s theorem supplies one useful sufficient condition: the normalized continued fraction\n\n\\[\\cfrac{a_1}{1+\\cfrac{a_2}{1+\\cdots}}\\]\n\nconverges if \\(|a_n|\\le1/4\\) for all \\(n\\ge1\\), and its value lies in the disk of radius \\(1/2\\) centered at zero.\n\nAn important analytic example is Lambert’s continued fraction,\n\n\\[\\tan z= \\cfrac{z}{1-\\cfrac{z^2}{3-\\cfrac{z^2}{5-\\cfrac{z^2}{7-\\cdots}}}},\\]\n\ninterpreted on its domain of convergence and through the corresponding meromorphic identity. A related expansion is\n\n\\[\\arctan z= \\cfrac{z}{1+\\cfrac{1^2z^2}{3+\\cfrac{2^2z^2}{5+\\cfrac{3^2z^2}{7+\\cdots}}}},\\]\n\nwhich, for example, holds for real \\(|z|\\le1\\). At \\(z=1\\), the latter represents \\(\\pi/4\\). Such expressions encode entire families of rational approximants, rather than just the approximation of one fixed numerical constant.\n\nContinued fractions also organize Padé approximation, in which a ratio of polynomials is chosen to match as many coefficients of a power series as possible. Suitable continued-fraction convergents reproduce particular sequences of Padé approximants. Rational approximants can model poles directly, whereas a polynomial truncation cannot; this can improve performance outside a small neighborhood of the expansion point, although convergence still requires separate analysis.\n\nAnother major connection is with orthogonal polynomials. Their three-term recurrences produce continued fractions for associated integral transforms. For a suitable positive measure \\(\\mu\\), the transform\n\n\\[F(z)=\\int_{\\mathbb R}\\frac{d\\mu(t)}{z-t}\\]\n\nhas a continued-fraction structure governed by the recurrence coefficients of its orthogonal polynomials. This relationship links continued fractions with moment problems, quadrature, and the spectral theory of tridiagonal operators. In these applications, the fraction records not merely a numerical value but structural information about a measure or operator."
    },
    {
      "heading": "Statistical laws and the Gauss map",
      "text": "Although some individual expansions are highly structured, typical continued fractions are described by probability laws. On irrational points of \\((0,1)\\), define the Gauss map\n\n\\[T(x)=\\frac1x-\\left\\lfloor\\frac1x\\right\\rfloor.\\]\n\nIf \\(x=[0;a_1,a_2,\\ldots]\\), then\n\n\\[T(x)=[0;a_2,a_3,\\ldots].\\]\n\nIteration removes successive coefficients. The continued-fraction algorithm can therefore be studied as a dynamical system on an interval, with the partial quotients serving as symbolic observations of its orbit.\n\nThe Gauss map preserves the probability measure\n\n\\[d\\mu(x)=\\frac{dx}{\\log2\\,(1+x)}.\\]\n\nPreservation means that a set and its inverse image under \\(T\\) have the same measure. The system is ergodic: invariant measurable sets have measure either zero or one. Consequently, long-run frequencies along almost every orbit equal the probabilities calculated from this measure. Here “almost every” means outside a set of Lebesgue measure zero. Because the Gauss measure and Lebesgue measure have the same null sets on \\((0,1)\\), either measure gives the same interpretation of exceptional sets.\n\nThe limiting frequency of the partial quotient \\(k\\), for almost every initial point, is\n\n\\[\\mu(a_1=k) = \\log_2\\left(\\frac{(k+1)^2}{k(k+2)}\\right).\\]\n\nThus \\(1\\) occurs with frequency\n\n\\[\\log_2(4/3)\\approx0.4150.\\]\n\nLarge partial quotients have a heavy tail:\n\n\\[\\mu(a_1\\ge k)=\\log_2\\left(1+\\frac1k\\right).\\]\n\nThe mean partial quotient under this distribution is infinite. Successive coefficients are not statistically independent, so their statistical theory is not simply the theory of repeated independent draws from this distribution.\n\nDespite the infinite arithmetic mean, the geometric mean has a universal finite limit. Khinchin’s theorem states that, for almost every real number,\n\n\\[\\lim_{n\\to\\infty}(a_1a_2\\cdots a_n)^{1/n} = K, \\qquad K\\approx2.685452001.\\]\n\nThe value \\(K\\) is Khinchin’s constant. A second almost-everywhere theorem describes denominator growth:\n\n\\[\\lim_{n\\to\\infty}\\frac{\\log q_n}{n} = \\frac{\\pi^2}{12\\log2}.\\]\n\nEquivalently, \\(q_n^{1/n}\\) tends to approximately \\(3.275822918\\), commonly called Lévy’s constant.\n\nThese statements do not apply automatically to a named constant. Quadratic irrationals, for example, have periodic coefficient sequences and need not share the generic limits. Major questions remain open about the coefficients of familiar numbers: it is not known whether the partial quotients of \\(\\pi\\) are bounded. More broadly, it is not known whether any real algebraic irrational of degree greater than two has bounded partial quotients, or whether any such number has unbounded partial quotients. The contrast between strong almost-everywhere laws and limited results for explicit algebraic numbers is a central feature of the subject."
    },
    {
      "heading": "Geometry, Farey fractions, and modular transformations",
      "text": "The determinant identity for convergents has a geometric interpretation. Regard \\((p_n,q_n)\\) and \\((p_{n-1},q_{n-1})\\) as vectors in the integer lattice \\(\\mathbb Z^2\\). Their determinant is \\(1\\) or \\(-1\\), so they form an integer basis of the lattice. The parallelogram they span has area \\(1\\). Meanwhile, the quantity\n\n\\[qx-p\\]\n\nmeasures signed displacement from the line \\(p=xq\\). Continued fractions select lattice vectors that approach this line efficiently while preserving the smallest possible nonzero lattice area between successive choices.\n\nA related structure appears in a Farey sequence, the increasing list of reduced fractions between \\(0\\) and \\(1\\) whose denominators do not exceed a specified bound. If \\(a/b<c/d\\) are neighboring fractions in such a sequence, then\n\n\\[bc-ad=1.\\]\n\nTheir mediant,\n\n\\[\\frac{a+c}{b+d},\\]\n\nlies strictly between them. When two reduced fractions have this determinant relation, every fraction strictly between them has denominator at least \\(b+d\\). This explains why mediants introduce the next possible fractions as a denominator bound increases.\n\nRepeated mediant insertion produces the Stern–Brocot tree, beginning with the boundary fractions \\(0/1\\) and \\(1/0\\). Every positive rational number occurs exactly once as an interior node. A search for a positive real number proceeds left or right according to whether the current mediant is larger or smaller than the target. For irrational targets the path is infinite. The lengths of consecutive runs in one direction encode the continued-fraction partial quotients, with a small adjustment to the initial run depending on the path convention. A sequence of potentially many individual mediant steps is thus compressed into one integer coefficient.\n\nContinued fractions also arise from fractional linear transformations,\n\n\\[x\\longmapsto\\frac{ax+b}{cx+d}, \\qquad ad-bc=\\pm1.\\]\n\nThese transformations act on the extended real line and preserve rational points. Integer translation and reciprocal inversion, the elementary operations in continued-fraction construction, belong to this family. The determinant-one transformations, with matrices identified up to sign, form the modular group. Its action on the upper half-plane connects continued fractions with hyperbolic geometry, where rational numbers appear as boundary points of the Farey tessellation.\n\nAn arithmetic consequence is a tail-equivalence theorem: two irrational real numbers are related by an integer fractional linear transformation of determinant \\(1\\) or \\(-1\\) if and only if their simple continued-fraction expansions eventually have identical tails. Finite modifications of the initial coefficients therefore correspond to an algebraic group action. This provides a bridge between symbolic coefficient sequences, lattice geometry, and the classification of quadratic irrationalities."
    },
    {
      "heading": "Computation and practical applications",
      "text": "For an exact rational input, coefficient extraction is an instance of the Euclidean algorithm and uses exact integer arithmetic. If the numerator and denominator have at most \\(N\\) binary digits, the number of divisions is \\(O(N)\\); consecutive Fibonacci numbers produce the classical worst case for the number of steps. This statement counts divisions rather than individual bit operations. The actual computational cost also depends on integer sizes and the division algorithms used, and fast variants can exploit accelerated greatest-common-divisor methods.\n\nFor a real input supplied numerically, coefficient extraction is more delicate. Taking a reciprocal magnifies uncertainty when the current fractional part is small. A tiny change in the input can therefore change a later partial quotient drastically. No finite-precision decimal observation can determine whether the underlying exact number is rational or irrational. Reliable implementations may use interval arithmetic: coefficients are certified only while every number in the current interval has the same integer part. If the interval crosses an integer boundary, additional precision is required.\n\nThis sensitivity is particularly relevant to floating-point arithmetic. Every finite binary floating-point value is itself rational, so its exact continued fraction terminates. That expansion need not continue to resemble the expansion of the ideal real number the value approximates. Rational reconstruction therefore requires an explicit error model or denominator limit. Given a denominator bound \\(Q\\), convergents and appropriate intermediate convergents locate small fractions consistent with the approximation. The result is a bounded-denominator approximation, not proof that a measured or rounded quantity equals that fraction exactly.\n\nGeneralized continued fractions require additional attention to numerical stability. Direct recurrence evaluation can produce very large numerators and denominators even when their ratio is moderate. Rescaling both without changing the ratio controls overflow, but does not by itself cure every conditioning problem. Backward evaluation starts from an assumed tail value and works toward the beginning; it can be effective when the influence of the tail decays. Modified Lentz-type algorithms instead update multiplicative corrections to the convergent and protect against near-zero intermediate quantities. They are widely used for continued-fraction representations of special functions, including certain incomplete gamma and beta function formulas.\n\nApplications also include exact integer-equation solving, rational approximation of engineering ratios, and recovery of hidden rational values from sufficiently precise numerical data. In quantum computing, the classical post-processing stage of Shor’s order-finding algorithm uses continued fractions to recover a fraction related to an unknown period from a measured phase estimate. In cryptanalysis, Wiener’s attack on certain RSA keys uses continued fractions of a public ratio to identify candidates for an unusually small secret exponent. Both applications depend on approximation theorems that force a sufficiently close rational estimate to appear among the convergents, together with additional problem-specific conditions and verification."
    },
    {
      "heading": "Historical development",
      "text": "Continued-fraction ideas arose from several traditions rather than a single invention. The Euclidean algorithm, recorded in Euclid’s *Elements* around 300 BCE, already contains the quotient process underlying finite expansions. Its geometric counterpart, repeated subtraction or comparison of magnitudes, is often called anthyphairesis. These ancient procedures should be distinguished from the modern notation and general theory of infinite continued fractions, which developed much later.\n\nIndian mathematics developed powerful methods for integer equations closely related to continued-fraction techniques. Brahmagupta’s seventh-century work on quadratic equations and the later chakravala method, prominently described by Bhāskara II in the twelfth century, produced solutions of equations now called Pell equations. These procedures were not simply modern simple continued fractions expressed in different notation, but they addressed the same arithmetic structures and sometimes reached solutions of remarkable size.\n\nIn early modern Europe, Rafael Bombelli’s L’Algebra of 1572 included methods related to continued-fraction approximations of square roots. Pietro Cataldi’s Trattato del modo brevissimo di trovare la radice quadra delli numeri of 1613 gave an explicit treatment of continued fractions for square roots. In the seventeenth century, William Brouncker discovered the celebrated generalized fraction\n\n\\[\\frac4\\pi = 1+\\cfrac{1^2}{2+\\cfrac{3^2}{2+\\cfrac{5^2}{2+\\cdots}}}.\\]\n\nJohn Wallis published it in Arithmetica Infinitorum in 1656. Its connection with Wallis’s product helped establish that continued fractions could represent analytic constants as well as support elementary arithmetic algorithms.\n\nLeonhard Euler greatly expanded the subject during the eighteenth century, deriving transformations, connecting fractions with series, and finding structured expansions of important constants. His work of 1737 established the irrationality of Euler’s number \\(e\\); its simple continued fraction is\n\n\\[e=[2;1,2,1,1,4,1,1,6,1,\\ldots].\\]\n\nJohann Heinrich Lambert used continued-fraction arguments in the 1760s to prove results on the irrationality of tangent values and hence the irrationality of \\(\\pi\\). Joseph-Louis Lagrange established the periodicity theorem for quadratic irrationals in 1770, giving a complete algebraic characterization of periodic simple expansions.\n\nDuring the nineteenth and twentieth centuries, the subject separated into several closely connected research directions. Carl Friedrich Gauss investigated the statistical distribution associated with the continued-fraction transformation. Thomas Joannes Stieltjes developed analytic continued fractions and their relationship with moment problems in the 1890s. Aleksandr Khinchin’s work in the 1930s established foundational metric results, while Paul Lévy determined the almost-everywhere exponential growth rate of convergent denominators. Later developments in ergodic theory and numerical analysis placed these arithmetic and analytic traditions within broader theories of dynamical systems, rational approximation, and computation."
    }
  ],
  "links": [
    "real-number",
    "number-theory",
    "euclidean-algorithm",
    "integer",
    "rational-number",
    "irrational-number",
    "positional-notation",
    "golden-ratio",
    "recurrence-relation",
    "fibonacci-sequence",
    "matrix",
    "determinant",
    "pi",
    "mathematical-analysis",
    "polynomial",
    "power-series",
    "orthogonal-polynomials",
    "spectral-theorem",
    "dynamical-system",
    "probability",
    "lebesgue-measure",
    "non-euclidean-geometry",
    "floating-point-arithmetic",
    "numerical-stability",
    "quantum-mechanics",
    "euclids-elements",
    "leonhard-euler",
    "e-mathematical-constant",
    "carl-friedrich-gauss"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}