The Farey sequence for any positive integer is the set of irreducible rational numbers with and arranged in increasing order. The first few are
(1)
(2)
(3)
(4)
(5)
(OEIS A006842 and A006843). Except for , each has an odd number of terms and the middle term is always 1/2.
Let , , and be three successive terms in a Farey series. Then
(6)
(7)
These two statements are actually equivalent (Hardy and Wright 1979, p. 24). For a method of computing a successive sequence from an existing one of terms, insert the mediant fraction between terms and when (Hardy and Wright 1979, pp. 25-26; Conway and Guy 1996; Apostol 1997). Given with , let be the mediant of and . Then , and these fractions satisfy the unimodular relations
(8)
(9)
(Apostol 1997, p. 99).
The number of terms in the Farey sequence for the integer is
Ford circles provide a method of visualizing the Farey sequence. The Farey sequence defines a subtree of the Stern-Brocot tree obtained by pruning unwanted branches (Graham et al. 1994).
The Season 2 episode "Bettor or Worse" (2006) of the television crime drama NUMB3RS features Farey sequences.