Farey sequence#Riemann hypothesis

{{Short description|Increasing sequence of reduced fractions}}

Image:Farey diagram horizontal arc 9.svg, hover over a curve to highlight it and its terms.]]

{{multiple image

| align = right

| direction = vertical

| image1 = Farey diagram square 9.svg|caption1=Farey diagram to F9.

| image2 = Farey sequence denominators 9.svg|caption2=Symmetrical pattern made by the denominators of the Farey sequence, F9.

| image3 = Farey sequence denominators 25.svg|caption3=Symmetrical pattern made by the denominators of the Farey sequence, F25.

}}

In mathematics, the Farey sequence of order n is the sequence of completely reduced fractions, either between 0 and 1, or without this restriction,{{efn|“The sequence of all reduced fractions with denominators not exceeding n, listed in order of their size, is called the Farey sequence of order n.” With the comment: “This definition of the Farey sequences seems to be the most convenient. However, some authors prefer to restrict the fractions to the interval from 0 to 1.” — Niven & Zuckerman (1972){{cite book |author1-link=Ivan M. Niven |first1=Ivan M. |last1=Niven |first2=Herbert S. |last2=Zuckerman |title=An Introduction to the Theory of Numbers |edition=Third |publisher=John Wiley and Sons |year=1972 |at=Definition 6.1}}}} which have denominators less than or equal to n, arranged in order of increasing size.

With the restricted definition, each Farey sequence starts with the value 0, denoted by the fraction {{sfrac|0|1}}, and ends with the value 1, denoted by the fraction {{sfrac|1}} (although some authors omit these terms).

A Farey sequence is sometimes called a Farey series, which is not strictly correct, because the terms are not summed.{{cite book|last1=Guthery |first1=Scott B. |year=2011 |title=A Motif of Mathematics: History and Application of the Mediant and the Farey Sequence |chapter=1. The Mediant |page=7 |publisher=Docent Press |location=Boston |language=en |isbn=978-1-4538-1057-6 |oclc=1031694495 |chapter-url=https://books.google.com/books?id=swb2c9enRJcC&pg=PA7 |access-date=28 September 2020}}

Examples

The Farey sequences of orders 1 to 8 are :

:F1 = { {{sfrac|0|1}}, {{sfrac|1|1}} }

:F2 = { {{sfrac|0|1}}, {{sfrac|1|2}}, {{sfrac|1|1}} }

:F3 = { {{sfrac|0|1}}, {{sfrac|1|3}}, {{sfrac|1|2}}, {{sfrac|2|3}}, {{sfrac|1|1}} }

:F4 = { {{sfrac|0|1}}, {{sfrac|1|4}}, {{sfrac|1|3}}, {{sfrac|1|2}}, {{sfrac|2|3}}, {{sfrac|3|4}}, {{sfrac|1|1}} }

:F5 = { {{sfrac|0|1}}, {{sfrac|1|5}}, {{sfrac|1|4}}, {{sfrac|1|3}}, {{sfrac|2|5}}, {{sfrac|1|2}}, {{sfrac|3|5}}, {{sfrac|2|3}}, {{sfrac|3|4}}, {{sfrac|4|5}}, {{sfrac|1|1}} }

:F6 = { {{sfrac|0|1}}, {{sfrac|1|6}}, {{sfrac|1|5}}, {{sfrac|1|4}}, {{sfrac|1|3}}, {{sfrac|2|5}}, {{sfrac|1|2}}, {{sfrac|3|5}}, {{sfrac|2|3}}, {{sfrac|3|4}}, {{sfrac|4|5}}, {{sfrac|5|6}}, {{sfrac|1|1}} }

:F7 = { {{sfrac|0|1}}, {{sfrac|1|7}}, {{sfrac|1|6}}, {{sfrac|1|5}}, {{sfrac|1|4}}, {{sfrac|2|7}}, {{sfrac|1|3}}, {{sfrac|2|5}}, {{sfrac|3|7}}, {{sfrac|1|2}}, {{sfrac|4|7}}, {{sfrac|3|5}}, {{sfrac|2|3}}, {{sfrac|5|7}}, {{sfrac|3|4}}, {{sfrac|4|5}}, {{sfrac|5|6}}, {{sfrac|6|7}}, {{sfrac|1|1}} }

:F8 = { {{sfrac|0|1}}, {{sfrac|1|8}}, {{sfrac|1|7}}, {{sfrac|1|6}}, {{sfrac|1|5}}, {{sfrac|1|4}}, {{sfrac|2|7}}, {{sfrac|1|3}}, {{sfrac|3|8}}, {{sfrac|2|5}}, {{sfrac|3|7}}, {{sfrac|1|2}}, {{sfrac|4|7}}, {{sfrac|3|5}}, {{sfrac|5|8}}, {{sfrac|2|3}}, {{sfrac|5|7}}, {{sfrac|3|4}}, {{sfrac|4|5}}, {{sfrac|5|6}}, {{sfrac|6|7}}, {{sfrac|7|8}}, {{sfrac|1|1}} }

class="toccolours" style="text-align:center; margin-top:1em"
Centered
F1 = { {{sfrac|0|1}}, {{sfrac|1|1}} }
F2 = { {{sfrac|0|1}}, {{sfrac|1|2}}, {{sfrac|1|1}} }
F3 = { {{sfrac|0|1}}, {{sfrac|1|3}}, {{sfrac|1|2}}, {{sfrac|2|3}}, {{sfrac|1|1}} }
F4 = { {{sfrac|0|1}}, {{sfrac|1|4}}, {{sfrac|1|3}}, {{sfrac|1|2}}, {{sfrac|2|3}}, {{sfrac|3|4}}, {{sfrac|1|1}} }
F5 = { {{sfrac|0|1}}, {{sfrac|1|5}}, {{sfrac|1|4}}, {{sfrac|1|3}}, {{sfrac|2|5}}, {{sfrac|1|2}}, {{sfrac|3|5}}, {{sfrac|2|3}}, {{sfrac|3|4}}, {{sfrac|4|5}}, {{sfrac|1|1}} }
F6 = { {{sfrac|0|1}}, {{sfrac|1|6}}, {{sfrac|1|5}}, {{sfrac|1|4}}, {{sfrac|1|3}}, {{sfrac|2|5}}, {{sfrac|1|2}}, {{sfrac|3|5}}, {{sfrac|2|3}}, {{sfrac|3|4}}, {{sfrac|4|5}}, {{sfrac|5|6}}, {{sfrac|1|1}} }
F7 = { {{sfrac|0|1}}, {{sfrac|1|7}}, {{sfrac|1|6}}, {{sfrac|1|5}}, {{sfrac|1|4}}, {{sfrac|2|7}}, {{sfrac|1|3}}, {{sfrac|2|5}}, {{sfrac|3|7}}, {{sfrac|1|2}}, {{sfrac|4|7}}, {{sfrac|3|5}}, {{sfrac|2|3}}, {{sfrac|5|7}}, {{sfrac|3|4}}, {{sfrac|4|5}}, {{sfrac|5|6}}, {{sfrac|6|7}}, {{sfrac|1|1}} }
F8 = { {{sfrac|0|1}}, {{sfrac|1|8}}, {{sfrac|1|7}}, {{sfrac|1|6}}, {{sfrac|1|5}}, {{sfrac|1|4}}, {{sfrac|2|7}}, {{sfrac|1|3}}, {{sfrac|3|8}}, {{sfrac|2|5}}, {{sfrac|3|7}}, {{sfrac|1|2}}, {{sfrac|4|7}}, {{sfrac|3|5}}, {{sfrac|5|8}}, {{sfrac|2|3}}, {{sfrac|5|7}}, {{sfrac|3|4}}, {{sfrac|4|5}}, {{sfrac|5|6}}, {{sfrac|6|7}}, {{sfrac|7|8}}, {{sfrac|1|1}} }

class="toccolours" style="margin-top:1em"
Sorted

F1 = {0/1, 1/1}

F2 = {0/1, 1/2, 1/1}

F3 = {0/1, 1/3, 1/2, 2/3, 1/1}

F4 = {0/1, 1/4, 1/3, 1/2, 2/3, 3/4, 1/1}

F5 = {0/1, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 1/1}

F6 = {0/1, 1/6, 1/5, 1/4, 1/3, 2/5, 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 1/1}

F7 = {0/1, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 2/5, 3/7, 1/2, 4/7, 3/5, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 1/1}

F8 = {0/1, 1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8, 1/1}

=Farey sunburst=

File:Sunburst 8.png

File:Farey sunbursts 1-10.svg

Plotting the numerators versus the denominators of a Farey sequence gives a shape like the one to the right, shown for {{math|{{var|F}}{{sub|6}}.}}

Reflecting this shape around the diagonal and main axes generates the Farey sunburst, shown below. The Farey sunburst of order {{mvar|n}} connects the visible integer grid points from the origin in the square of side {{math|2{{var|n}}}}, centered at the origin. Using Pick's theorem, the area of the sunburst is {{math|4({{abs|{{var|F}}{{sub|{{var|n}}}}}} − 1)}}, where {{math|{{abs|{{var|F}}{{sub|{{var|n}}}}}}}} is the #Sequence_length_and_index_of_a_fraction.

File:Farey_sunburst_6.svg ]]

History

:The history of 'Farey series' is very curious — Hardy & Wright (1979){{cite book |author1-link=G. H. Hardy |author1=Hardy, G.H. |author2-link=E. M. Wright |author2=Wright, E.M. |year=1979 |title=An Introduction to the Theory of Numbers |edition=Fifth |publisher=Oxford University Press |isbn=0-19-853171-0 |at=[https://archive.org/details/introductiontoth00hard/page/ Chapter III] |url=https://archive.org/details/introductiontoth00hard/page/ }}

:... once again the man whose name was given to a mathematical relation was not the original discoverer so far as the records go. — Beiler (1964){{cite book |author=Beiler, Albert H. |year=1964 |title=Recreations in the Theory of Numbers |edition=Second |publisher=Dover |isbn=0-486-21096-0 |at=Chapter XVI}} Cited in {{cite web |url=http://www.cut-the-knot.org/blue/FareyHistory.shtml |title=Farey Series, A Story |publisher=Cut-the-Knot}}

Farey sequences are named after the British geologist John Farey, Sr., whose letter about these sequences was published in the Philosophical Magazine in 1816.{{citation | url=https://archive.org/details/s2id13416200/page/384/mode/2up | author=John Farey Sr. | title=On a curious property of vulgar fractions | journal=Philosophical Magazine | volume=47 | year=1816 | pages=385–386}} Farey conjectured, without offering proof, that each new term in a Farey sequence expansion is the mediant of its neighbours. Farey's letter was read by Cauchy, who provided a proof in his Exercices de mathématique, and attributed this result to Farey. In fact, another mathematician, Charles Haros, had published similar results in 1802 which were not known either to Farey or to Cauchy. Thus it was a historical accident that linked Farey's name with these sequences. This is an example of Stigler's law of eponymy.

Properties

=Sequence length and index of a fraction=

The Farey sequence of order {{mvar|n}} contains all of the members of the Farey sequences of lower orders. In particular {{mvar|Fn}} contains all of the members of {{math|Fn−1}} and also contains an additional fraction for each number that is less than {{mvar|n}} and coprime to {{mvar|n}}. Thus {{math|F6}} consists of {{math|F5}} together with the fractions {{sfrac|1|6}} and {{sfrac|5|6}}.

The middle term of a Farey sequence {{mvar|Fn}} is always {{sfrac|1|2}},

for {{math|n > 1}}. From this, we can relate the lengths of {{mvar|Fn}} and {{math|Fn−1}} using Euler's totient function {{math|φ(n)}}:

|F_n| = |F_{n-1}| + \varphi(n).

Using the fact that {{math|1={{abs|F1}} = 2}}, we can derive an expression for the length of {{mvar|Fn}}:{{Cite OEIS|A005728}}

|F_n| = 1 + \sum_{m=1}^n \varphi(m) = 1 + \Phi(n),

where {{math|Φ(n)}} is the summatory totient.

We also have :

|F_n| = \frac{1}{2}\left(3+\sum_{d=1}^n \mu(d) \left\lfloor \tfrac{n}{d} \right\rfloor^2 \right),

and by a Möbius inversion formula :

|F_n| = \frac{1}{2} (n+3)n - \sum_{d=2}^n|F_{\lfloor n/d \rfloor}|,

where {{math|μ(d)}} is the number-theoretic Möbius function, and \lfloor n/d \rfloor is the floor function.

The asymptotic behaviour of {{math|{{abs|Fn}}}} is :

|F_n| \sim \frac {3n^2}{\pi^2}.

The number of Farey fractions with denominators equal to {{mvar|k}} in {{mvar|Fn}} is given by {{math|φ(k)}} when {{math|kn}} and zero otherwise. Concerning the numerators one can define the function \mathcal{N}_n(h) that returns the number of Farey fractions with numerators equal to {{mvar|h}} in {{mvar|Fn}}. This function has some interesting properties as{{cite journal |last=Tomas Garcia |first=Rogelio |url=https://math.colgate.edu/~integers/y63/y63.pdf|title=Farey Fractions with Equal Numerators and the Rank of Unit Fractions

| journal=Integers | date=July 2024 |volume=24 |doi=10.5281/zenodo.12685697 |arxiv=2404.08283 }}

:\mathcal{N}_n(1)=n,

:\mathcal{N}_n(p^m)=\left\lceil(n-p^m) \left(1- 1/p \right)\right\rceil for any prime number p,

:\mathcal{N}_{n+mh}(h)=\mathcal{N}_{n}(h) + m\varphi(h) for any integer {{math|m ≥ 0}},

:\mathcal{N}_{n}(4h)=\mathcal{N}_{n}(2h) - \varphi(2h).

In particular, the property in the third line above implies \mathcal{N}_{mh}(h)=(m-1)\varphi(h) and, further, \mathcal{N}_{2h}(h)=\varphi(h). The latter means that, for Farey sequences of even order {{mvar|n}}, the number of fractions with numerators equal to {{math|{{sfrac|n|2}}}} is the same as the number of fractions with denominators equal to {{math|{{sfrac|n|2}}}}, that is \mathcal{N}_{n}(n/2) = \varphi(n/2).

The index I_n(a_{k,n}) = k of a fraction a_{k,n} in the Farey sequence F_n=\{a_{k,n} : k = 0, 1, \ldots, m_n\} is simply the position that a_{k,n} occupies in the sequence. This is of special relevance as it is used in an alternative formulation of the Riemann hypothesis, see below. Various useful properties follow:

\begin{align}

I_n(0/1) &= 0, \\[6pt]

I_n(1/n) &= 1, \\[2pt]

I_n(1/2) &= \frac{|F_n|-1}{2}, \\[2pt]

I_n(1/1) &= |F_n|-1 , \\[2pt]

I_n(h/k) &= |F_n|-1 - I_n\left(\frac{k-h}{k}\right).

\end{align}

The index of {{math|{{sfrac|1|k}}}} where {{math|{{sfrac|n|i+1}} < k ≤ {{sfrac|n|i}}}} and {{mvar|n}} is the least common multiple of the first {{mvar|i}} numbers, {{math|1=n = lcm([2, i])}}, is given by:{{cite journal |last=Tomas |first=Rogelio |url=https://cs.uwaterloo.ca/journals/JIS/VOL25/Tomas/tomas5.pdf|title=Partial Franel sums | journal=Journal of Integer Sequences | date=January 2022 |volume=25 |issue=1 }}

I_n(1/k) = 1 + n \sum_{j=1}^{i} \frac{\varphi(j)}{j} - k\Phi(i).

A similar expression was used as an approximation of I_n(x) for low values of x in the classical paper by F. Dress.{{cite journal |last=Dress |first=F. |url=http://archive.numdam.org/article/JTNB_1999__11_2_345_0.pdf|title=Discrépance des suites de Farey| journal= J. Théorie des Nr. Bordx.| date=1999 |volume=11 }} A general expression for I_n(h/k) for any Farey fraction h/k is given in.{{cite journal |last=Tomas Garcia |first=Rogelio |url=https://www.mdpi.com/2227-7390/13/1/140|title=New Analytical Formulas for the Rank of Farey Fractions and Estimates of the Local Discrepancy| journal=Mathematics| date=2025 |volume=13 |issue=1 |page=140 |doi=10.3390/math13010140 |doi-access=free }}

=Farey neighbours<!-- This section is linked from [[Farey pair]] -->=

Fractions which are neighbouring terms in any Farey sequence are known as a Farey pair and have the following properties.

If {{math|{{sfrac|a|b}}}} and {{math|{{sfrac|c|d}}}} are neighbours in a Farey sequence, with {{math|{{sfrac|a|b}} < {{sfrac|c|d}}}}, then their difference {{math|{{sfrac|c|d}} − {{sfrac|a|b}}}} is equal to {{math|{{sfrac|1|bd}}}}. Since

\frac{c}{d} - \frac{a}{b} = \frac{bc - ad}{bd},

this is equivalent to saying that

bc - ad = 1.

Thus {{sfrac|1|3}} and {{sfrac|2|5}} are neighbours in {{math|F5}}, and their difference is {{sfrac|1|15}}.

The converse is also true. If

bc - ad = 1

for positive integers {{math|a, b, c, d}} with {{math|a < b}} and {{math|c < d}}, then {{math|{{sfrac|a|b}}}} and {{math|{{sfrac|c|d}}}} will be neighbours in the Farey sequence of order {{math|max(b,d)}}.

If {{math|{{sfrac|p|q}}}} has neighbours {{math|{{sfrac|a|b}}}} and {{math|{{sfrac|c|d}}}} in some Farey sequence, with {{math|{{sfrac|a|b}} < {{sfrac|p|q}} < {{sfrac|c|d}}}}, then {{math|{{sfrac|p|q}}}} is the mediant of {{math|{{sfrac|a|b}}}} and {{math|{{sfrac|c|d}}}} – in other words,

\frac{p}{q} = \frac{a + c}{b + d}.

This follows easily from the previous property, since if

\begin{align}

&& bp - aq &= qc - pd = 1, \\[4pt]

\implies && bp + pd &= qc + aq, \\[4pt]

\implies && p(b + d) &= q(a + c), \\

\implies && \frac{p}{q} &= \frac{a+c}{b+d}.

\end{align}

It follows that if {{math|{{sfrac|a|b}}}} and {{math|{{sfrac|c|d}}}} are neighbours in a Farey sequence then the first term that appears between them as the order of the Farey sequence is incremented is

\frac{a+c}{b+d},

which first appears in the Farey sequence of order {{math|b + d}}.

Thus the first term to appear between {{sfrac|1|3}} and {{sfrac|2|5}} is {{sfrac|3|8}}, which appears in {{math|F8}}.

The total number of Farey neighbour pairs in {{mvar|Fn}} is {{math|2{{abs|Fn}} − 3}}.

The Stern–Brocot tree is a data structure showing how the sequence is built up from 0 {{pars|{{=}} {{sfrac|0|1}}|150%}} and 1 {{pars|{{=}} {{sfrac|1|1}}|150%}}, by taking successive mediants.

== Equivalent-area interpretation ==

Every consecutive pair of Farey rationals have an equivalent area of 1.{{cite web |last1=Austin |first1=David |date=December 2008 |title=Trees, Teeth, and Time: The mathematics of clock making |website=American Mathematical Society |location=Rhode Island |language=en |url=http://www.ams.org/publicoutreach/feature-column/fcarc-stern-brocot |access-date=28 September 2020 |url-status=live |archive-url=https://web.archive.org/web/20200204014725/http://www.ams.org/publicoutreach/feature-column/fcarc-stern-brocot |archive-date=4 February 2020}} See this by interpreting consecutive rationals

r_1 = \frac{p}{q} \qquad r_2 = \frac{p'}{q'}

as vectors {{math|(p, q)}} in the xy-plane. The area is given by

A \left(\frac{p}{q}, \frac{p'}{q'} \right) = qp' - q'p.

As any added fraction in between two previous consecutive Farey sequence fractions is calculated as the mediant (⊕), then

\begin{align}

A(r_1, r_1 \oplus r_2) &= A(r_1, r_1) + A(r_1, r_2) \\

&= A(r_1, r_2) \\

&= 1

\end{align}

(since {{math|1=r1 = {{sfrac|1|0}}}} and {{math|1=r2 = {{sfrac|0|1}}}}, its area must be 1).

=Farey neighbours and continued fractions=

Fractions that appear as neighbours in a Farey sequence have closely related continued fraction expansions. Every fraction has two continued fraction expansions — in one the final term is 1; in the other the final term is greater by 1. If {{math|{{sfrac|p|q}}}}, which first appears in Farey sequence {{mvar|Fq}}, has the continued fraction expansions

\begin{align}

&[0;\ a_1,\ a_2,\ \ldots,\ a_{n-1},\ a_n,\ 1] \\{}

&[0;\ a_1,\ a_2,\ \ldots,\ a_{n-1},\ a_n + 1]

\end{align}

then the nearest neighbour of {{math|{{sfrac|p|q}}}} in {{mvar|F{{sub|q}}}} (which will be its neighbour with the larger denominator) has a continued fraction expansion

[0;\ a_1,\ a_2,\ \ldots,\ a_n]

and its other neighbour has a continued fraction expansion

[0;\ a_1,\ a_2,\ \ldots,\ a_{n-1}]

For example, {{sfrac|3|8}} has the two continued fraction expansions {{math|[0; 2, 1, 1, 1]}} and {{math|[0; 2, 1, 2]}}, and its neighbours in {{math|F8}} are {{sfrac|2|5}}, which can be expanded as {{math|[0; 2, 1, 1]}}; and {{sfrac|1|3}}, which can be expanded as {{math|[0; 2, 1]}}.

=Farey fractions and the least common multiple=

The lcm can be expressed as the products of Farey fractions as

\text{lcm}[1,2,...,N] = e^{\psi(N)} = \frac{1}{2} \left( \prod_{r \in F_N, 0

where {{math|ψ(N)}} is the second Chebyshev function.{{Cite arXiv |eprint = 0907.4384|last1 = Martin|first1 = Greg|title = A product of Gamma function values at fractions with the same denominator|class = math.CA|year = 2009}}{{Cite arXiv |eprint=0909.1838 |last1=Wehmeier |first1=Stefan |title=The LCM(1,2,...,n) as a product of sine values sampled over the points in Farey sequences |class=math.CA |year=2009}}

=Farey fractions and the greatest common divisor=

Since the Euler's totient function is directly connected to the gcd so is the number of elements in {{mvar|Fn}},

|F_n| = 1 + \sum_{m=1}^n \varphi(m) = 1+ \sum\limits_{m=1}^{n} \sum\limits_{k=1}^m \gcd(k,m) \cos {2\pi\frac{k}{m}} .

For any 3 Farey fractions {{math|{{sfrac|a|b}}, {{sfrac|c|d}}, {{sfrac|e|f}}}} the following identity between the gcd's of the 2x2 matrix determinants in absolute value holds:{{cite journal |last=Tomas Garcia |first=Rogelio |url=http://rtomas.web.cern.ch/rtomas/NNTDM-26-3-005-007.pdf|title=Equalities between greatest common divisors involving three coprime pairs| journal=Notes on Number Theory and Discrete Mathematics |date=August 2020 |volume=26 |issue=3|pages=5–7 |doi= 10.7546/nntdm.2020.26.3.5-7 |s2cid=225280271 |doi-access=free }}

\gcd\left(\begin{Vmatrix} a & c\\b & d \end{Vmatrix}, \begin{Vmatrix} a & e\\b & f \end{Vmatrix} \right)

= \gcd\left(\begin{Vmatrix} a & c\\b & d \end{Vmatrix}, \begin{Vmatrix} c & e\\d & f \end{Vmatrix} \right)

= \gcd\left(\begin{Vmatrix} a & e\\b & f \end{Vmatrix}, \begin{Vmatrix} c & e\\d & f \end{Vmatrix} \right)

{{cite journal |last=Tomas |first=Rogelio |url=https://cs.uwaterloo.ca/journals/JIS/VOL25/Tomas/tomas5.pdf|title=Partial Franel sums | journal=Journal of Integer Sequences | date=January 2022 |volume=25 |issue=1 }}

=Applications=

Farey sequences are very useful to find rational approximations of irrational numbers.{{cite web |url=https://nrich.maths.org/6596 |title=Farey Approximation |website=NRICH.maths.org |access-date=18 November 2018 |archive-url=https://web.archive.org/web/20181119092100/https://nrich.maths.org/6596 |archive-date=19 November 2018 |url-status=dead}} For example, the construction by Eliahou{{cite journal |last1=Eliahou |first1=Shalom |title=The 3x+1 problem: new lower bounds on nontrivial cycle lengths |journal=Discrete Mathematics |date=August 1993 |volume=118 |issue=1–3 |pages=45–56 |doi=10.1016/0012-365X(93)90052-U|doi-access=free }} of a lower bound on the length of non-trivial cycles in the 3x+1 process uses Farey sequences to calculate a continued fraction expansion of the number {{math|log2(3)}}.

In physical systems with resonance phenomena, Farey sequences provide a very elegant and efficient method to compute resonance locations in 1D{{cite journal |last1=Zhenhua Li |first1=A. |last2=Harter |first2=W.G. |arxiv=1308.4470 |title=Quantum Revivals of Morse Oscillators and Farey–Ford Geometry |journal=Chem. Phys. Lett. |year=2015 |volume=633 |pages=208–213 |doi=10.1016/j.cplett.2015.05.035|bibcode=2015CPL...633..208L |s2cid=66213897 }} and 2D.{{cite journal |last1=Tomas |first1=R. |year=2014 |doi=10.1103/PhysRevSTAB.17.014001|title=From Farey sequences to resonance diagrams |journal=Physical Review Special Topics - Accelerators and Beams |volume=17 |issue=1 |page=014001|bibcode=2014PhRvS..17a4001T |doi-access=free |url=http://cds.cern.ch/record/2135825/files/10.1103_PhysRevSTAB.17.014001.pdf }}

Farey sequences are prominent in studies of any-angle path planning on square-celled grids, for example in characterizing their computational complexity{{cite journal |last1=Harabor |first1=Daniel Damir |last2=Grastien |first2=Alban |last3=Öz |first3=Dindar |last4=Aksakalli |first4=Vural |title=Optimal Any-Angle Pathfinding In Practice |journal=Journal of Artificial Intelligence Research |date=26 May 2016 |volume=56 |pages=89–118 |doi=10.1613/jair.5007|doi-access=free }} or optimality.{{cite journal |last1=Hew |first1=Patrick Chisan |title=The Length of Shortest Vertex Paths in Binary Occupancy Grids Compared to Shortest r-Constrained Ones |journal=Journal of Artificial Intelligence Research |date=19 August 2017 |volume=59 |pages=543–563 |doi=10.1613/jair.5442|doi-access=free }} The connection can be considered in terms of {{mvar|r}}-constrained paths, namely paths made up of line segments that each traverse at most {{mvar|r}} rows and at most {{mvar|r}} columns of cells. Let {{mvar|Q}} be the set of vectors {{math|(q, p)}} such that 1 \leq q \leq r, 0 \leq p \leq q, and {{mvar|p}}, {{mvar|q}} are coprime. Let {{mvar|Q*}} be the result of reflecting {{mvar|Q}} in the line {{math|1=y = x}}. Let S = \{ (\pm x, \pm y) : (x, y) \in Q \cup Q* \}. Then any {{mvar|r}}-constrained path can be described as a sequence of vectors from {{mvar|S}}. There is a bijection between {{mvar|Q}} and the Farey sequence of order {{mvar|r}} given by {{math|(q, p)}} mapping to \tfrac{p}{q}.

=Ford circles=

File:Comparison_Ford_circles_Farey_diagram.svg, hover over a circle or curve to highlight it and its terms.]]

There is a connection between Farey sequence and Ford circles.

For every fraction {{math|{{sfrac|p|q}}}} (in its lowest terms) there is a Ford circle {{math|C[p/q]}}, which is the circle with radius \tfrac{1}{2q^2} and centre at \bigl(\tfrac{p}{q}, \tfrac{1}{2q^2}\bigr). Two Ford circles for different fractions are either disjoint or they are tangent to one another—two Ford circles never intersect. If {{math|0 < {{sfrac|p|q}} < 1}} then the Ford circles that are tangent to {{math|C[p/q]}} are precisely the Ford circles for fractions that are neighbours of {{math|{{sfrac|p|q}}}} in some Farey sequence.

Thus {{math|C[2/5]}} is tangent to {{math|C[1/2]}}, {{math|C[1/3]}}, {{math|C[3/7]}}, {{math|C[3/8]}}, etc.

Ford circles appear also in the Apollonian gasket {{math|(0,0,1,1)}}. The picture below illustrates this together with Farey resonance lines.{{cite arXiv |last=Tomas |first=Rogelio |eprint=2006.10661|title=Imperfections and corrections |class= physics.acc-ph|year=2020 }}

File:Apolloinan gasket Farey.png {{math|(0,0,1,1)}} and the Farey resonance diagram.]]

=Riemann hypothesis=

Farey sequences are used in two equivalent formulations of the Riemann hypothesis. Suppose the terms of {{mvar|F{{sub|n}}}} are \{a_{k,n} : k = 0, 1, \ldots, m_n\}. Define d_{k,n} = a_{k,n} - \tfrac{k}{m_n}, in other words d_{k,n} is the difference between the {{mvar|k}}th term of the {{mvar|n}}th Farey sequence, and the {{mvar|k}}th member of a set of the same number of points, distributed evenly on the unit interval. In 1924 Jérôme Franel{{cite journal |author-link=Jérôme Franel |first=Jérôme |last=Franel |url=http://www.digizeitschriften.de/dms/resolveppn/?PID=GDZPPN00250653X |title=Les suites de Farey et le problème des nombres premiers |journal=Nachrichten von der Gesellschaft der Wissenschaften zu Göttingen |series=Mathematisch-Physikalische Klasse |year=1924 |pages=198–201 |language=fr}} proved that the statement

\sum_{k=1}^{m_n} d_{k,n}^2 = O (n^r) \quad \forall r > -1

is equivalent to the Riemann hypothesis, and then Edmund Landau{{cite journal |author-link=Edmund Landau |first=Edmund |last=Landau |url=http://www.digizeitschriften.de/dms/resolveppn/?PID=GDZPPN002506548 |title=Bemerkungen zu der vorstehenden Abhandlung von Herrn Franel |journal=Nachrichten von der Gesellschaft der Wissenschaften zu Göttingen |series=Mathematisch-Physikalische Klasse |year=1924 |pages=202–206 |language=de}} remarked (just after Franel's paper) that the statement

\sum_{k=1}^{m_n} |d_{k,n}| = O (n^r) \quad \forall r > \frac{1}{2}

is also equivalent to the Riemann hypothesis.

= Other sums involving Farey fractions =

The sum of all Farey fractions of order {{mvar|n}} is half the number of elements:

\sum_{r\in F_n} r = \frac{1}{2} |F_n| .

The sum of the denominators in the Farey sequence is twice the sum of the numerators and relates to Euler's totient function:

\sum_{a/b \in F_n} b = 2 \sum_{a/b \in F_n} a = 1 + \sum_{i=1}^{n} i\varphi(i) ,

which was conjectured by Harold L. Aaron in 1962 and demonstrated by Jean A. Blake in 1966.{{Cite journal|first1=Jean A.|last1=Blake|doi=10.2307/2313922 |title=Some Characteristic Properties of the Farey Series|journal=The American Mathematical Monthly| volume=73|issue=1|year=1966|pages=50–52 |jstor=2313922 }} A one line proof of the Harold L. Aaron conjecture is as follows.

The sum of the numerators is

1 + \sum_{2 \le b \le n} \ \sum_{(a,b)=1} a = 1 + \sum_{2 \le b \le n} b\frac{\varphi(b)}{2}.

The sum of denominators is

2 + \sum_{2 \le b \le n} \ \sum_{(a,b)=1} b = 2 + \sum_{2 \le b \le n} b\varphi(b).

The quotient of the first sum by the second sum is {{sfrac|1|2}}.

Let {{mvar|bj}} be the ordered denominators of {{mvar|Fn}}, then:{{Cite journal |jstor=10.4169/000298910X475005 |doi=10.4169/000298910X475005 |title=Farey Sums and Dedekind Sums |journal=The American Mathematical Monthly |volume=117 |issue=1 |pages=72–78 |year=2010 |last1=Kurt Girstmair |last2=Girstmair |first2=Kurt|s2cid=31933470 }}

\sum_{j=0}^

F_n
1} \frac{b_j}{b_{j+1}} = \frac{3|F_n
4}{2}

and

\sum_{j=0}^{|F_n

1} \frac{1}{b_{j+1}b_{j}} = 1.

Let \tfrac{a_j}{b_j} the {{mvar|j}}th Farey fraction in {{mvar|Fn}}, then

\sum_{j=1}^{|F_n

1} (a_{j-1}b_{j+1} - a_{j+1}b_{j-1})

= \sum_{j=1}^{|F_n

1} \begin{Vmatrix}

a_{j-1} & a_{j+1} \\

b_{j-1} & b_{j+1}

\end{Vmatrix} = 3(|F_n

1) - 2n - 1,

which is demonstrated in.{{cite journal|first1=R. R. |last1=Hall |first2= P. |last2=Shiu |title= The Index of a Farey Sequence|journal= Michigan Math. J. | volume=51 | year =2003| doi=10.1307/mmj/1049832901|number=1 |pages=209–223|doi-access=free }}

Also according to this reference the term inside the sum can be expressed in many different ways:

a_{j-1} b_{j+1} - a_{j+1} b_{j-1} = \frac{b_{j-1}+b_{j+1}}{b_{j}} = \frac{a_{j-1}+a_{j+1}}{a_{j}} = \left\lfloor\frac{n+ b_{j-1}}{b_{j}} \right\rfloor,

obtaining thus many different sums over the Farey elements with same result. Using the symmetry around 1/2 the former sum can be limited to half of the sequence as

\sum_{j=1}^{\left\lfloor \frac{|F_n

{2} \right\rfloor} (a_{j-1} b_{j+1} - a_{j+1} b_{j-1}) = \frac{3(|F_n|-1)}{2} - n - \left\lceil \frac{n}{2} \right\rceil ,

The Mertens function can be expressed as a sum over Farey fractions as

M(n)= -1+ \sum_{a\in \mathcal{F}_n} e^{2\pi i a}

where \mathcal{F}_n is the Farey sequence of order {{mvar|n}}.

This formula is used in the proof of the Franel–Landau theorem.{{cite book|last1=Edwards |first1=Harold M. |author1-link=Harold Edwards (mathematician) |editor1-last=Smith|editor1-first=Paul A.|editor1-link=Paul Althaus Smith|editor2-last=Ellenberg|editor2-first=Samuel|editor2-link=Samuel Eilenberg|year=1974 |title=Riemann's Zeta Function |chapter=12.2 Miscellany. The Riemann Hypothesis and Farey Series |publisher=Academic Press |series=Pure and Applied Mathematics|pages=263{{ndash}}267 |location=New York |language=en |isbn=978-0-08-087373-2 |oclc=316553016 |chapter-url=https://archive.org/details/riemannszetafunc00edwa_0/page/262 |chapter-url-access=registration |access-date=30 September 2020}}

Next term

A surprisingly simple algorithm exists to generate the terms of Fn in either traditional order (ascending) or non-traditional order (descending). The algorithm computes each successive entry in terms of the previous two entries using the mediant property given above. If {{sfrac|a|b}} and {{sfrac|c|d}} are the two given entries, and {{sfrac|p|q}} is the unknown next entry, then {{math|1={{sfrac|c|d}} = {{sfrac|a + p|b + q}}}}. Since {{sfrac|c|d}} is in lowest terms, there must be an integer k such that {{math|1=kc = a + p}} and {{math|1=kd = b + q}}, giving {{math|1=p = kca}} and {{math|1=q = kdb}}. If we consider p and q to be functions of k, then

: \frac{p(k)}{q(k)}- \frac{c}{d} = \frac{cb - da}{d(kd - b)}

so the larger k gets, the closer {{sfrac|p|q}} gets to {{sfrac|c|d}}.

To give the next term in the sequence k must be as large as possible, subject to {{math|1=kdbn}} (as we are only considering numbers with denominators not greater than n), so k is the greatest {{nowrap|integer ≤ {{sfrac|n + b|d}}}}. Putting this value of k back into the equations for p and q gives

: p = \left\lfloor\frac{n+b}{d}\right\rfloor c - a

: q = \left\lfloor\frac{n+b}{d}\right\rfloor d - b

This is implemented in Python as follows:

from fractions import Fraction

from collections.abc import Generator

def farey_sequence(n: int, descending: bool = False) -> Generator[Fraction]:

"""

Print the n'th Farey sequence. Allow for either ascending or descending.

>>> print(*farey_sequence(5), sep=' ')

0 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1

"""

a, b, c, d = 0, 1, 1, n

if descending:

a, c = 1, n - 1

yield Fraction(a, b)

while 0 <= c <= n:

k = (n + b) // d

a, b, c, d = c, d, k * c - a, k * d - b

yield Fraction(a, b)

if __name__ == "__main__":

import doctest

doctest.testmod()

Brute-force searches for solutions to Diophantine equations in rationals can often take advantage of the Farey series (to search only reduced forms). While this code uses the first two terms of the sequence to initialize a, b, c, and d, one could substitute any pair of adjacent terms in order to exclude those less than (or greater than) a particular threshold.{{cite magazine |first=Norman |last=Routledge |title=Computing Farey series |magazine=The Mathematical Gazette |volume=92 |issue=523 |pages=55–62 |date=March 2008}}

See also

Footnotes

{{notelist|1}}

References

{{reflist|25em}}

Further reading

  • {{citation

| last1 = Hatcher | first1 = Allen

| title = Topology of Numbers

| publisher = American Mathematical Society

| location = Providence, RI

| date = 2022

| isbn = 978-1470456115}}

  • {{cite book |author1-link=Ronald L. Graham |first1=Ronald L. |last1=Graham |author2-link=Donald E. Knuth |first2=Donald E. |last2=Knuth |author3-link=Oren Patashnik |first3=Oren |last3=Patashnik |title=Concrete Mathematics: A foundation for computer science |edition=2nd |publisher=Addison-Wesley |place=Boston, MA |year=1989 |isbn=0-201-55802-5 |pages=115–123, 133–139, 150, 462–463, 523–524}} — in particular, see §4.5 (pp. 115–123), Bonus Problem 4.61 (pp. 150, 523–524), §4.9 (pp. 133–139), §9.3, Problem 9.3.6 (pp. 462–463).
  • {{cite web |first=Linas |last=Vepstas |title=The Minkowski Question Mark, GL(2,Z), and the Modular Group |url=http://linas.org/math/chap-minkowski.pdf}} — reviews the isomorphisms of the Stern-Brocot Tree.
  • {{cite web |first=Linas |last=Vepstas |title=Symmetries of Period-Doubling Maps |url=http://linas.org/math/chap-takagi.pdf}} — reviews connections between Farey Fractions and Fractals.
  • {{cite journal |first1=Cristian |last1=Cobeli |first2=Alexandru |last2=Zaharescu |title=The Haros–Farey sequence at two hundred years. A survey |journal=Acta Univ. Apulensis Math. Inform. |issue=5 |year=2003 |pages=1–38}} {{cite web |url=http://www.emis.de/journals/AUA/acta5/survey3.ps_pages1-20.pdf |website=Acta Univ. Apulensis |title=pp. 1–20}} {{cite web |url=http://www.emis.de/journals/AUA/acta5/survey3.ps_pages21-38.pdf |website=Acta Univ. Apulensis |title=pp. 21–38}}
  • {{cite book |first=Andrey O. |last=Matveev |title=Farey Sequences: Duality and Maps Between Subsequences |publisher=De Gruyter |place=Berlin, DE |year=2017 |isbn=978-3-11-054662-0}} [https://github.com/andreyomatveev/farey-sequences Errata + Code]{{cbignore}}