Cleaner, Clearer, and Just Plain Fun

Continued fractions really are interesting buggers. They’re interesting both in theoretical terms and in terms of just fun, odd properties.

With regular fractions, it’s easy to take the reciprocal—you just swap the numerator and the denominator. It looks like it’s going to be difficult to do that with a continued fraction, but it isn’t. It’s even easier! Take a number like 2.3456, aka [2; 2, 3, 1, 3, 4, 5, 6, 4]. The reciprocal is [0; 2, 2, 3, 1, 3, 4, 5, 6, 4]. We just add a zero to the front as the integer part, and push everything else one place to the right. If it was a zero in front, then we would have removed the zero and pulled everything else one place to the left.

Using continued fractions, we ...

Get Good Math now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.