Skip to main content
Back to Guides
6 min read4 Steps

How to Calculate Continued Fractions Manually: A Step-by-Step Guide

Learn to manually calculate continued fractions for any real number or fraction. Understand the algorithm, work through an example, and avoid common pitfalls.

Skip the math — use the calculator

Step-by-Step Instructions

1

Identify Your Number and Initial Integer Part

Start with the real number or fraction you wish to convert, let's call it `x_0`. Your first step is to extract its integer part. This is the first partial quotient, `a_0`, found by applying the floor function: `a_0 = floor(x_0)`.

2

Calculate the Remainder and Its Reciprocal

Next, determine the fractional part, or remainder, `r_0 = x_0 - a_0`. If `r_0` is exactly zero, the process terminates, and your continued fraction is simply `[a_0]`. If `r_0` is not zero, calculate its reciprocal to form the next number in the sequence: `x_1 = 1 / r_0`. This `x_1` will be the input for the next iteration.

3

Iterate for Subsequent Partial Quotients

Repeat the process from Step 1 with `x_1` (or `x_i` in general). Find `a_1 = floor(x_1)`, then `r_1 = x_1 - a_1`, and if `r_1 ≠ 0`, calculate `x_2 = 1 / r_1`. Continue this iterative process, finding `a_i` and `r_i`, until you reach a remainder `r_n` that is exactly zero. For rational numbers, this process is guaranteed to terminate.

4

Construct the Continued Fraction and Convergents

Once the process terminates (or you've reached your desired number of terms for irrational numbers), collect all the partial quotients `a_0, a_1, a_2, ..., a_n`. The continued fraction is written as `[a_0; a_1, a_2, ..., a_n]`. You can then calculate the convergents, which are rational approximations of the original number, using the iterative formulas `p_k = a_k * p_{k-1} + p_{k-2}` and `q_k = a_k * q_{k-1} + q_{k-2}`.

Continued fractions offer a unique way to represent real numbers, providing a sequence of increasingly accurate rational approximations. They are fundamental in number theory, cryptography, and various engineering applications. While automated calculators simplify the process, understanding the manual calculation provides deep insight into their structure and properties.

This guide will walk you through the manual process of converting any real number or fraction into its continued fraction representation, including deriving its convergents.

Prerequisites

Before you begin, ensure you have a solid understanding of:

  • Basic Arithmetic: Proficiency in addition, subtraction, multiplication, and division, especially with fractions.
  • Integers and Fractions: Comfort working with both positive and negative integers, and expressing numbers as fractions.
  • Floor Function: Understanding the floor function, denoted as [x] or floor(x), which gives the greatest integer less than or equal to x. For example, [3.14] = 3, [5] = 5, and [-2.7] = -3.
  • Reciprocals: Knowing that the reciprocal of a number y is 1/y.

The Continued Fraction Algorithm

The process of finding a continued fraction is an iterative application of the Euclidean algorithm. For a given real number 'x', the algorithm extracts its integer part, then takes the reciprocal of the fractional part, and repeats.

Here's the general procedure:

  1. Start with the number: Let your initial number be x_0.
  2. Extract the integer part: The first partial quotient, a_0, is the floor of x_0: a_0 = [x_0].
  3. Calculate the fractional part: The remainder, r_0, is x_0 - a_0.
  4. Check for termination: If r_0 = 0, the process terminates. The continued fraction is [a_0].
  5. Compute the reciprocal: If r_0 ≠ 0, calculate the reciprocal of the fractional part: x_1 = 1 / r_0.
  6. Repeat: Treat x_1 as the new number and go back to step 2 to find a_1, r_1, and potentially x_2. Continue this process until a remainder of zero is achieved (for rational numbers) or to a desired precision (for irrational numbers).

The resulting continued fraction is represented as [a_0; a_1, a_2, a_3, ...]. The values a_i are called the partial quotients.

Convergents

Each truncation of a continued fraction yields a rational approximation called a convergent. These convergents can be calculated iteratively:

  • C_0 = a_0 / 1
  • C_1 = a_0 + 1/a_1 = (a_0 * a_1 + 1) / a_1
  • C_2 = a_0 + 1/(a_1 + 1/a_2)

In general, if p_n and q_n are the numerator and denominator of the n-th convergent C_n = p_n / q_n, then:

  • p_n = a_n * p_{n-1} + p_{n-2}
  • q_n = a_n * q_{n-1} + q_{n-2}

with initial conditions: p_{-2} = 0, q_{-2} = 1, p_{-1} = 1, q_{-1} = 0.

Step-by-Step Worked Example: Calculating the Continued Fraction for 27/11

Let's apply the algorithm to the fraction 27/11.

Step 1: Initial Integer Part and Remainder

  • Our starting number is x_0 = 27/11.
  • Calculate the integer part: a_0 = [27/11] = [2.4545...] = 2.
  • Calculate the remainder: r_0 = 27/11 - 2 = 27/11 - 22/11 = 5/11.

Step 2: First Reciprocal and Next Integer Part

  • Since r_0 is not zero, calculate its reciprocal: x_1 = 1 / (5/11) = 11/5.
  • Calculate the integer part of x_1: a_1 = [11/5] = [2.2] = 2.
  • Calculate the remainder: r_1 = 11/5 - 2 = 11/5 - 10/5 = 1/5.

Step 3: Second Reciprocal and Next Integer Part

  • Since r_1 is not zero, calculate its reciprocal: x_2 = 1 / (1/5) = 5.
  • Calculate the integer part of x_2: a_2 = [5] = 5.
  • Calculate the remainder: r_2 = 5 - 5 = 0.

Step 4: Construct the Continued Fraction and Convergents

  • Since r_2 is zero, the process terminates. The partial quotients are a_0 = 2, a_1 = 2, a_2 = 5.
  • The continued fraction for 27/11 is [2; 2, 5].

Now, let's calculate the convergents using the iterative formulas:

  • p_{-2} = 0, q_{-2} = 1
  • p_{-1} = 1, q_{-1} = 0

For n = 0 (a_0 = 2):

  • p_0 = a_0 * p_{-1} + p_{-2} = 2 * 1 + 0 = 2
  • q_0 = a_0 * q_{-1} + q_{-2} = 2 * 0 + 1 = 1
  • C_0 = p_0 / q_0 = 2/1 = 2

For n = 1 (a_1 = 2):

  • p_1 = a_1 * p_0 + p_{-1} = 2 * 2 + 1 = 5
  • q_1 = a_1 * q_0 + q_{-1} = 2 * 1 + 0 = 2
  • C_1 = p_1 / q_1 = 5/2 = 2.5

For n = 2 (a_2 = 5):

  • p_2 = a_2 * p_1 + p_0 = 5 * 5 + 2 = 27
  • q_2 = a_2 * q_1 + q_0 = 5 * 2 + 1 = 11
  • C_2 = p_2 / q_2 = 27/11 ≈ 2.4545...

As expected, the last convergent equals the original number.

Common Pitfalls to Avoid

  • Incorrect Floor Function Application: Ensure you correctly identify the greatest integer less than or equal to your current number. For negative numbers, remember [-2.7] is -3, not -2.
  • Fractional Arithmetic Errors: Mistakes often occur when subtracting the integer part from the original number, especially when dealing with improper fractions or converting to common denominators.
  • Reciprocal Miscalculations: Taking the reciprocal of a fraction (e.g., 1 / (a/b) = b/a) is straightforward but can lead to errors if rushed.
  • Premature Termination: For rational numbers, the process must terminate when the remainder is exactly zero. Do not stop if you have a very small, non-zero remainder.
  • Decimal Approximations (for exact calculations): When working with fractions, maintain them as fractions throughout the process to ensure exact results. Converting to decimals and rounding can introduce errors, especially for numbers with non-terminating decimal expansions.

When to Use an Automated Calculator

While manual calculation is excellent for understanding, an automated continued fraction calculator offers significant advantages for:

  • Large or Complex Numbers: Manually calculating continued fractions for numbers like π or e to many terms is extremely tedious and prone to error.
  • Verification: Quickly check your manual calculations to ensure accuracy.
  • Speed and Efficiency: For quick approximations or when needing many terms of a continued fraction without the educational benefit of manual work.
  • High Precision: Automated tools can handle numbers with many decimal places or very large numerators/denominators without loss of precision.

By understanding both the manual process and the utility of automated tools, you gain a comprehensive grasp of continued fractions.

Ready to Calculate?

Skip the manual work and get instant results.

Open Calculator

Settings

PrivacyTermsAbout© 2026 PrimeCalcPro