We know, thanks to Georg Cantor, that the rational numbers — ratios of integers — are countable: they can be put into one-to-one correspondence with the natural numbers.

How can we make a list that includes all rationals? For the present, let us consider rationals in the interval . It would be nice if we could list all these rationals in order from smallest to largest. But for any rational we have ; there is no smallest such rational. Indeed, the rationals are *dense* in . Between any two rationals lies another, and the closure of the set of rationals is .

**Following Cantor**

One method of listing all rationals in the interval is to follow the example of Cantor. We write a 2-dimensional array, with all rationals having equal denominators in a single row.

Fig 1: Array of rational numbers between 0 and 1.

The ratio is interpreted as the number . Many numbers occur more than once in this array, for example and so on. We replace duplicates by the symbol to indicate that they are to be ignored. Then every rational number in occurs precisely once:

Now it is a simple matter to list all rational numbers with denominators up to 8 by taking the entries in the above table row by row:

These are not in order of magnitude. If we rearrange them in ascending order, we get what is known as the eighth *Farey Sequence*:

** Farey Sequences **

The Farey sequence of order is the sequence of (reduced) fractions between 0 and 1 which have denominators less than or equal to , arranged in order of increasing size. Each Farey sequence starts with the value 0 (=0/1) and ends with the value 1 (=1/1). There are 23 terms in the eighth Farey sequence. A table of sequences of orders up to 8 is shown below.

Farey sequences of orders 1 to 8, arranged to show new entries at each stage.

The numbers in this table are arranged to show, at the top of each column, the new rationals entering at each stage. John Farey speculated, in 1816, that each new entry is the *mediant* of its neighbours. That is, for two adjacent fractions and , the new number is :

For example, between 3/5 and 2/3, the next rational to appear is 5/8. It is a consequence of this relationship that, at any stage, if and are two neighbouring entries with , then .

The mediant property allows us to build up the successive Farey sequences. The Farey sequence is formed by computing the mediant of each pair of consecutive values in and placing each value with denominator between the two fractions from which it was formed.

Chapter III of Hardy and Wright (1960) is devoted to Farey Sequences. They give a short account of the curious history of the naming of the Farey Sequences. John Farey stated the key properties without proving them. Cauchy provided proofs and ascribed the credit to Farey. But the theorems had been stated and proved much earlier by Haros (Hardy and Wright, p. 36).

The Farey sequences are closely related to the Stern-Brocot tree, a topic to which I hope to return in a subsequent post.

** Sources **

Hardy, Godfrey Harold and Wright, E. M. (1960): *An Introduction to the Theory of Numbers* (Fourth Ed.), Oxford, at the Clarendon Press.

Wikipedia article *Farey Sequences.*