LEARN AT YOUR PACE

Farey sequences: neighbors and the mediant

Published

A Farey sequence of order n, written Fn, lists the fractions in lowest terms between 0 and 1 with denominator at most n, from smallest to largest. F5 has 11 terms: 0/1, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5 and 1/1. Two consecutive terms a/b and c/d satisfy bc − ad = 1, and the fraction with the smallest denominator that fits between them is their mediant, (a + c)/(b + d).

To check any pair of fractions and see the value between them, use the fraction between two fractions tool. This guide explains why the neighbor rule works and when the mediant is the simplest answer.

Worked example: the mediant of 1/3 and 2/5

In F5 these two fractions are consecutive terms. Which fraction gets inserted between them, and in which sequence does it first appear?

  1. Check that they are neighbors. With a/b = 1/3 and c/d = 2/5, bc − ad = 3 × 2 − 1 × 5 = 1.
  2. Add separately. Numerators: 1 + 2 = 3. Denominators: 3 + 5 = 8.
  3. Write the mediant. (1 + 2)/(3 + 5) = 3/8.
  4. Find the order. The denominator is 8, so it first appears in F8.

Result: 3/8 = 0.375, new in F8.

Check: 0.333… < 0.375 < 0.4, so the mediant lies inside. Also, 3 and 8 have no common factor, so the fraction is already in lowest terms.

Which fractions make up each sequence

Lowest terms means the numerator and denominator are coprime, that is, their greatest common factor (GCF) is 1. That is why 2/4 is not in F5: it equals 1/2, and each value is written only once. The greatest common factor tool checks that condition.

Each sequence contains the previous one and adds the fractions in lowest terms whose denominator is exactly n. The table gives the numerators that enter at each order. For example, F4 adds two fractions with denominator 4.

New numerators (over the denominator n) and total number of terms in F1 to F8
OrderNew numeratorsTotal
F10 and 1 over 12
F213
F31 and 25
F41 and 37
F51, 2, 3 and 411
F61 and 513
F71 to 619
F81, 3, 5 and 723

The total grows irregularly because only the numerators coprime to n enter at each order: six fractions with denominator 7, which is prime, and only two with denominator 6. On the fraction number line you can see that each new fraction lands in a gap between two terms of the previous list.

How to get from Fn to the next sequence

To build F(n+1), go through Fn and look at each pair of neighbors a/b and c/d. If b + d equals n + 1, insert the mediant between them. If b + d is larger, that pair gets nothing at this step, because the mediant belongs to a later order.

With F5 and n + 1 = 6, the only pairs whose denominators add up to 6 are 0/1 with 1/5 and 4/5 with 1/1. You insert 1/6 and 5/6, and the 11 fractions become 13. To reach F7 you insert one mediant in each pair whose denominators add up to 7, six in all (1/7, 2/7, 3/7, 4/7, 5/7 and 6/7); for example, 0/1 and 1/6 give 1/7, and 1/4 and 1/3 give 2/7.

From F7, the pair in the worked example has denominators that add up to 8, so its mediant is one of the four fractions F8 adds. Each step is local, because only two adjacent terms and the sum of their denominators matter.

How to tell whether two fractions are neighbors

Two fractions a/b < c/d are neighbors in some Farey sequence exactly when bc − ad = 1. Compute the two cross products and subtract them. If the result is 1, no fraction with a denominator less than or equal to the larger of the two denominators lies between them. If it is 2 or more, one does.

Neighbor test with bc − ad
Pair a/b and c/dCalculationNeighbors?
2/5 and 1/25 × 1 − 2 × 2 = 1Yes
3/4 and 4/54 × 4 − 3 × 5 = 1Yes
1/6 and 1/46 × 1 − 1 × 4 = 2No, 1/5 fits
1/5 and 3/45 × 3 − 1 × 4 = 11No, several fit

A result greater than 1 means there are other fractions with a small denominator between the two. Between 1/6 and 1/4, the fraction 1/5 sits in the middle.

Why neighbors always give 1

The property is preserved at every step of the construction. In F1, 0/1 and 1/1 give 1 × 1 − 0 × 1 = 1. If a/b and c/d are neighbors, the two pairs formed by their mediant (a + c)/(b + d) also give 1: b(a + c) − a(b + d) = bc − ad and (b + d)c − (a + c)d = bc − ad. Since both pairs give the same result as the original pair, the difference stays 1 at every order.

Why the mediant is the simplest fraction between neighbors

If a/b and c/d are neighbors (the condition from the previous section), every fraction p/q strictly between them has q ≥ b + d, and the only one with q = b + d is the mediant. The reason lies in the distances: p/q − a/b is positive and has denominator bq, so it is at least 1/(bq); likewise c/d − p/q is at least 1/(dq). Adding them, c/d − a/b = 1/(bd) must be at least (b + d)/(bdq), and from that q ≥ b + d follows.

The statement requires the endpoints to be neighbors. With 1/3 and 3/4, which are not, the mediant is 4/7, but 1/2 also lies inside and has a smaller denominator.

Simplest fraction between two decimals

If a value lies between two decimals, look for the fraction with the smallest denominator that falls inside. For 0.32 and 0.34, no fraction with denominator 1 or 2 fits, and with denominator 3 you get 1/3 = 0.333… (repeating), which is inside. The endpoints are 8/25 and 17/50, with much larger denominators. To convert the endpoints to fractions, the decimal to fraction converter gives the exact form.

The general method takes a pair of neighbors that encloses the interval and climbs by mediants until one falls inside. To check the order of two candidates, the compare fractions tool settles it exactly. If what you want is the idea that there is always another fraction between two fractions, the guide on a fraction between two fractions covers that density.

Practice

  1. Find the simplest fraction between 0.71 and 0.72.
  2. Check whether 3/5 and 2/3 are neighbors and find their mediant.
  3. In which Farey sequence does 3/7 first appear?
Show the answers
  1. 5/7 = 0.714285… ≈ 0.7143 (error less than 0.00002). No fraction with a denominator less than 7 falls inside the interval.
  2. 5 × 2 − 3 × 3 = 1, so they are neighbors. The mediant is (3 + 2)/(5 + 3) = 5/8.
  3. In F7, because its denominator is 7 and 3/7 is in lowest terms.

Ford circles

Each fraction a/b can be drawn as a circle of radius 1/(2b²) resting on the number line at a/b. Two of these circles are tangent exactly when the fractions satisfy the neighbor condition. So the neighbor test is also a geometric test of contact.

When another tool is more direct

A Farey sequence helps you find intermediate terms and see how fractions with small denominators are spread out. To sort a list of fractions, the order fractions calculator applies the comparison directly. To simplify a fraction, divide the numerator and denominator by their GCF with the simplify fractions calculator. Another route to approximations with small denominators is continued fractions, which are related to the mediant. The sequences cover only the stretch from 0 to 1.

Sources

English Wikipedia, in its article Farey sequence, describes the sequence as the completely reduced fractions with denominators less than or equal to n, in increasing order. It also states that for neighbors a/b and c/d the difference is 1/(bd), which is equivalent to the neighbor condition bc − ad = 1 (accessed October 17, 2026).

Next step

Advanced fractions Combined operations, powers, roots, complex, algebraic, partial, continued and Egyptian fractions, equations and exact results: pick the…
Report an errorHow we handle corrections

Use the fraction calculator

YOUR CALCULATOR, CLOSE AT HAND

Save your calculator

Open your browser menu and choose “Install app” or “Add to Home Screen”. You can also bookmark this page.