Farey Sequence

The Farey sequence F_n for any positive integer n is the set of irreducible rational numbers a/b with 0<=a<=b<=n and (a,b)=1 arranged in increasing order. The first few are

F_1={0/1,1/1}
(1)
F_2={0/1,1/2,1/1}
(2)
F_3={0/1,1/3,1/2,2/3,1/1}
(3)
F_4={0/1,1/4,1/3,1/2,2/3,3/4,1/1}
(4)
F_5={0/1,1/5,1/4,1/3,2/5,1/2,3/5,2/3,3/4,4/5,1/1}
(5)

(OEIS A006842 and A006843). Except for F_1, each F_n has an odd number of terms and the middle term is always 1/2.

Let p/q, p^'/q^', and p^('')/q^('') be three successive terms in a Farey series. Then

 qp^'-pq^'=1
(6)
 (p^')/(q^')=(p+p^(''))/(q+q^('')).
(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 n terms, insert the mediant fraction (a+b)/(c+d) between terms a/c and b/d when c+d<=n (Hardy and Wright 1979, pp. 25-26; Conway and Guy 1996; Apostol 1997). Given 0<=a/b<c/d<=1 with bc-ad=1, let h/k be the mediant of a/b and c/d. Then a/b<h/k<c/d, and these fractions satisfy the unimodular relations

 bh-ak=1
(8)
 ck-dh=1
(9)

(Apostol 1997, p. 99).

The number of terms N(n) in the Farey sequence for the integer n is

N(n)=1+sum_(k=1)^(n)phi(k)
(10)
=1+Phi(n),
(11)

where phi(k) is the totient function and Phi(n) is the summatory function of phi(k), giving 2, 3, 5, 7, 11, 13, 19, ... (OEIS A005728). The asymptotic limit for the function N(n) is

 N(n)∼(3n^2)/(pi^2)=0.3039635509n^2
(12)

(Vardi 1991, p. 155).

Ford circles provide a method of visualizing the Farey sequence. The Farey sequence F_n 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.

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.