Continued Fraction Calculator

Continued Fraction Diagram
Continued Fraction Visualization

Understanding Continued Fractions

What is a Continued Fraction?

A continued fraction is a representation of a real number using a sequence of integers and reciprocals. It's an alternative way to express numbers, especially useful for representing irrational numbers.

Formula and Notation

A continued fraction is typically written as:

\[a_0 + \frac{1}{a_1 + \frac{1}{a_2 + \frac{1}{a_3 + \ddots}}}\]

Where \(a_0\) is an integer, and \(a_1, a_2, a_3, \ldots\) are positive integers.

It's often abbreviated as \([a_0; a_1, a_2, a_3, \ldots]\).

Calculation Steps

To convert a number \(x\) to a continued fraction:

  1. Take the integer part of \(x\): \(a_0 = \lfloor x \rfloor\)
  2. Calculate the fractional part: \(r = x - a_0\)
  3. If \(r = 0\), stop. Otherwise, set \(x = \frac{1}{r}\) and go back to step 1

Example

Let's convert 3.245 to a continued fraction:

  1. \(a_0 = \lfloor 3.245 \rfloor = 3\), \(r = 3.245 - 3 = 0.245\)
  2. \(x = \frac{1}{0.245} = 4.0816...\)
  3. \(a_1 = \lfloor 4.0816... \rfloor = 4\), \(r = 4.0816... - 4 = 0.0816...\)
  4. \(x = \frac{1}{0.0816...} = 12.25\)
  5. \(a_2 = \lfloor 12.25 \rfloor = 12\), \(r = 12.25 - 12 = 0.25\)
  6. \(x = \frac{1}{0.25} = 4\)
  7. \(a_3 = 4\)

Therefore, 3.245 ≈ [3; 4, 12, 4]

Visual Representation

Continued Fraction Visualization: 3.245 = [3; 4, 12, 4] 3.245 ⌊3.245⌋ = 3 r = 0.245 1/0.245 = 4.0816... ⌊4.0816...⌋ = 4 r = 0.0816 1/0.0816 = 12.25 ⌊12.25⌋ = 12 3.245 = 3 + 1 /(4 + 1/(12 + 1/4)) = [3; 4, 12, 4] Each step shows the division process and integer part extraction

This diagram visually represents the continued fraction for 3.245.