Continued Fraction Convergents Calculator

Enter the continued-fraction terms to list its convergents.

How it is calculated

Enter the terms a0, a1, a2, … separated by commas, spaces or semicolons, where [a0; a1, a2, …] means a0 + 1/(a1 + 1/(a2 + …)). Each term is rounded to a whole number; a0 may be any integer, but every later term must be 1 or more. The convergent after each term comes from the recurrence

hn = an·hn−1 + hn−2
kn = an·kn−1 + kn−2

started with h−1 = 1, h−2 = 0 and k−1 = 0, k−2 = 1. The convergent is hn/kn. The tool lists every convergent with its decimal value (six decimals) and finishes with the last one to eight decimals. A text that is not a number, a later term below 1, or a numerator or denominator that would pass 64 bits (19 digits) makes the entry invalid and the tool returns no result. The fractions are not reduced beyond this recurrence.

Worked example

Terms 3, 7, 15, 1 (the start of the expansion of π). Step 0: h = 3, k = 1, so 3/1. Step 1: h = 7×3 + 1 = 22, k = 7×1 + 0 = 7, so 22/7. Step 2: h = 15×22 + 3 = 333, k = 15×7 + 1 = 106, so 333/106. Step 3: h = 1×333 + 22 = 355, k = 1×106 + 7 = 113, giving 355/113. Its decimal value is 3.14159292, close to π (3.14159265) to about seven digits.

Try this example →

Common mistakes

  • Typing a decimal number such as 3.14159 instead of its terms. This tool does not expand a decimal into terms; you must supply the integers yourself, for example 3, 7, 15, 1.
  • Entering a fractional term, like 1.5. It is rounded to 2, so the convergents belong to a different continued fraction than you meant.
  • Entering a zero or negative term after the first. Every term after a0 must be a whole number of 1 or more, so 0, 0 or -3, 2, -5 returns no result.
  • Copying the textbook notation with brackets, like [3; 7, 15]. The brackets are not numbers, so the entry is rejected; type just 3, 7, 15.
  • Reading the last convergent as exact. It is only the approximation from the terms you gave; a longer list gives a closer fraction.

About this calculator

A continued fraction [a₀; a₁, a₂, a₃, …] represents a number as a nested sequence of integer terms, and its convergents are the successive fractions obtained by truncating that sequence at each step — each one the best possible rational approximation of the target value for its denominator size. Convergents are computed with the recurrence h_n = a_n·h_{n−1} + h_{n−2} and k_n = a_n·k_{n−1} + k_{n−2}, giving the convergent as h_n/k_n.

Mathematicians and number theorists use continued fraction convergents to find compact rational approximations of irrational constants like π or √2, and the same technique shows up in practical engineering problems such as choosing gear-tooth counts or musical tuning ratios that closely approximate an irrational target with small whole numbers.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    The tool takes the terms of a continued fraction, not a decimal, so to approximate a number you first need its expansion. A very large term is a useful clue: the convergent just before it is an unusually good fit, which is why 355/113 is so close to pi, right before the 292. Keep the list to a modest length, because once a numerator or denominator passes 19 digits the tool returns no result. What number are you approximating?

Popular calculators

All Calculators