Continued Fractions
Continued Fractions
Continued fractions are a way of representing a number as a sum of an integer and a fraction.
Mathematically, a continued fraction is a representation
ai,biare complex numbers. The continued fraction with bi=1 ∀i is called a simple continued fraction and continued fractions with finite number of ai are called finite continued fractions.
Consider example rational numbers,
the continued fractions could be written as
Notation
A simple continued fraction is represented as a list of coefficients(ai) i.e
for the above example
Computation of simple continued fractions
Given a number x, the coefficients(ai) in its continued fraction representation can be calculated recursively using
The above notation might not be obvious. Observing the structure of continued fraction with few coefficients will make them more evident:
SageMath provides functions continued_fraction and continued_fraction_list to work with continued fractions. Below is presented a simple implementation of continued_fractions.
Convergents of continued fraction
The kthconvergent of a continued fractionx=[a0;a1, a2, a3, a4,…]is the numerical value or approximation calculated using the firstk−1coefficients of the continued fraction. The firstkconvergents are
One of the immediate applications of the convergents is that they give rational approximations given the continued fraction of a number. This allows finding rational approximations to irrational numbers.
Convergents of continued fractions can be calculated in sage
Continued fractions have many other applications. One such applicable in cryptology is based on Legendre's theorem in diophantine approximations.
Theorem: if∣x−ba∣<b21, thenbais a convergent ofx.
Wiener's attack on the RSA cryptosystem works by proving that under certain conditions, an equation of the form∣x−ba∣could be derived wherexis entirely made up of public information andbais made up of private information. Under assumed conditions, the inequality∣x−ba∣<b21is statisfied, and the valueba(private information) is calculated from convergents ofx(public information), consequently breaking the RSA cryptosystem.
Last updated
Was this helpful?