Calculator: Continued fraction

Enter the labelled inputs to calculate: Result; Value p; Value q.

Result
3; 4
Value p
13
Value q
4

How the calculation works

x=a₀+1/(a₁+1/(…)); pₙ=aₙpₙ₋₁+pₙ₋₂

Integer inputs are bounded as shown. Exact integer results are displayed in full. Iterative tools have finite work limits; the Collatz calculation does not assert a general convergence proof.

Values must satisfy the formula’s domain. Nonzero results too small or too large for reliable representation are rejected.

Frequently asked questions

How is the result calculated?

x=a₀+1/(a₁+1/(…)); pₙ=aₙpₙ₋₁+pₙ₋₂

What assumptions apply?

Integer inputs are bounded as shown. Exact integer results are displayed in full. Iterative tools have finite work limits; the Collatz calculation does not assert a general convergence proof.

How precise are the displayed results?

Numerical results show up to ten significant digits. Rounding does not improve the accuracy of the input measurements or the model. Values must satisfy the formula’s domain. Nonzero results too small or too large for reliable representation are rejected.

How we verified this calculator

The calculator is checked against 3 reference cases computed independently from the sources below. Last passed: .

# Inputs Expected result
1
Value = 3.14159
Count = 4
Result: 3; 7; 15; 1
Value p: 355
Value q: 113
2
Value = 1.41421356
Count = 5
Result: 1; 2; 2; 2; 2
Value p: 41
Value q: 29
3
Value = 2.718281828
Count = 6
Result: 2; 1; 2; 1; 1; 4
Value p: 87
Value q: 32

Sources

How we test our calculators →

Also try:

Back to category →