# Representing Numbers as Continued Fractions and a TI-Nspire Package to do some Basic Continued Fraction Arithmetic

## Abstract

From birth most human beings are confronted by the number 10. In general, we have ten fingers and ten toes. It was only natural that we developed decimal numbers for doing our basic calculations. When computers came along with their binary states (over simplified as a switch being on and off) binary arithmetic came into its own. (One wonders, do cats use a base twelve arithmetic when catching mice?) However, decimal and binary arithmetic have their limits when it comes to doing calculations that require very accurate approximations for certain results. Accurate decimal approximations may require the use of numerous digits and computing systems contain only a finite model of the real numbers. Continued Fractions are an alternative representation for numbers that are generally able to compactly represent approximations to real numbers for a desired accuracy. Computer Algebra Systems have long used continued fractions while implementing the approximation operation when requested by a user.Continued fractions have their roots in the so-called Euclidean Algorithm for finding the greatest common divisor of two integers. In fact, finding the continued fraction representation of a rational number follows the steps of this algorithm exactly. However, they did not become an object of mathematical study until the work of Brouncker and Wallis in the late 17th century. An impediment to their growth in popularity was the lack of an efficient system of doing arithmetic with this representation of the real numbers. In 1972 William Gosper developed an efficient system for doing arithmetic with continued fractions and show them that numbers can be represented more efficiently as continued fractions. For example, √17 = 4.12310562561..., can be approximated as [4; 8, 8, 8, 8] = 17684/4289 = 4.123105619... that has a much smaller denominator than the decimal representation having the same accuracy.

In this presentation, a small package for use in classroom exercises to introduce students to this different way of viewing real numbers and using continued fractions, thus, expanding their view of number representations and their uses, will be discussed. It will deal with converting rational numbers to continued fractions as well as the reverse process. It will also include an algorithm for expressing square roots of integers as, sometimes infinite, periodic continued fractions. Also included will be Gosper’s algorithms for doing arithmetic with continued fractions. Time permitting, other topics such as the expansion of π and e as infinite continued fractions will be presented. A TI- Nspire package containing these results developed by the author will be previewed. It will also be made available for sharing with participants.