Continued Fractions — From Euclid Steps to Convergents on a Number Line

The CF of p/q is the list of Euclidean quotients [a0; a1, a2, ...]; its convergents pk/qk = akpk-1+pk-2 over akqk-1+qk-2 close in on the target, alternating above and below.

step 0

Euclidean steps → partial quotients

p=a·q+ rquotient a
partial quotient ak

Convergents pk/qk

below target (even k) above target (odd k)

Convergents closing in on the target

Press Step to begin. We run Euclid on p/q, peel off the partial quotients a0, a1, ..., then build each convergent with the recurrence and plot it.
Self-contained visualization. Exact integer arithmetic (no floating point in the recurrence). Convergents satisfy the determinant identity p_k q_{k-1} - p_{k-1} q_k = (-1)^{k-1} and the error bound |x - p_k/q_k| < 1/q_k². See junior.md for the worked example and professional.md for the proofs.