In
mathematics
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
, the Farey sequence of order ''n'' is the
sequence
In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed and order matters. Like a set, it contains members (also called ''elements'', or ''terms''). The number of elements (possibly infinite) is calle ...
of completely reduced
fraction
A fraction (from la, fractus, "broken") represents a part of a whole or, more generally, any number of equal parts. When spoken in everyday English, a fraction describes how many parts of a certain size there are, for example, one-half, eight ...
s, either between 0 and 1, or without this restriction, which when
in lowest terms
An irreducible fraction (or fraction in lowest terms, simplest form or reduced fraction) is a fraction (mathematics), fraction in which the numerator and denominator are integers that have no other common divisors than 1 (and −1, when negative nu ...
have
denominator
A fraction (from la, fractus, "broken") represents a part of a whole or, more generally, any number of equal parts. When spoken in everyday English, a fraction describes how many parts of a certain size there are, for example, one-half, eight ...
s 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 , and ends with the value 1, denoted by the fraction (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.
Examples
The Farey sequences of orders 1 to 8 are :
:''F''
1 =
:''F''
2 =
:''F''
3 =
:''F''
4 =
:''F''
5 =
:''F''
6 =
:''F''
7 =
:''F''
8 =
Plotting the numerators versus the denominators of a Farey sequence gives a shape like the one to the right, shown for
6.
Reflecting this shape around the diagonal and main axes generates the ''Farey sunburst'', shown below. The Farey sunburst of order connects the visible integer grid points from the origin in the square of side 2, centered at the origin. Using
Pick's theorem
In geometry, Pick's theorem provides a formula for the area of a simple polygon with integer vertex coordinates, in terms of the number of integer points within it and on its boundary. The result was first described by Georg Alexander Pick in 18 ...
the area of the sunburst is 4(,
n, −1), where ,
n, is the number of fractions in
n.
History
:''The history of 'Farey series' is very curious'' — Hardy & Wright (1979)
:''... 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)
[ Cited in ]
Farey sequences are named after the
British
British may refer to:
Peoples, culture, and language
* British people, nationals or natives of the United Kingdom, British Overseas Territories, and Crown Dependencies.
** Britishness, the British identity and common culture
* British English, ...
geologist
A geologist is a scientist who studies the solid, liquid, and gaseous matter that constitutes Earth and other terrestrial planets, as well as the processes that shape them. Geologists usually study geology, earth science, or geophysics, althou ...
John Farey, Sr., whose letter about these sequences was published in the ''
Philosophical Magazine
The ''Philosophical Magazine'' is one of the oldest scientific journals published in English. It was established by Alexander Tilloch in 1798;John Burnett"Tilloch, Alexander (1759–1825)" Oxford Dictionary of National Biography, Oxford Univer ...
'' in 1816. Farey conjectured, without offering proof, that each new term in a Farey sequence expansion is the
mediant In music, the mediant (''Latin'': to be in the middle) is the third scale degree () of a diatonic scale, being the note halfway between the tonic and the dominant.Benward & Saker (2003), p.32. In the movable do solfège system, the mediant note i ...
of its neighbours. Farey's letter was read by
Cauchy
Baron Augustin-Louis Cauchy (, ; ; 21 August 178923 May 1857) was a French mathematician, engineer, and physicist who made pioneering contributions to several branches of mathematics, including mathematical analysis and continuum mechanics. He w ...
, who provided a proof in his ''Exercices de mathématique'', and attributed this result to Farey. In fact, another mathematician,
Charles Haros
Charles Haros was a geometer (mathematician) in the French Bureau du Cadastre at the end of the eighteenth century and the beginning of the nineteenth century.
Haros' conversion table
One of the primary tasks of the Bureau du Cadastre was the ...
, 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
Stigler's law of eponymy, proposed by University of Chicago statistics professor Stephen Stigler in his 1980 publication ''Stigler’s law of eponymy'', states that no scientific discovery is named after its original discoverer. Examples include ...
.
Properties
Sequence length and index of a fraction
The Farey sequence of order ''n'' contains all of the members of the Farey sequences of lower orders. In particular ''Fn'' contains all of the members of ''F''''n''−1 and also contains an additional fraction for each number that is less than ''n'' and coprime
In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
to ''n''. Thus ''F''6 consists of ''F''5 together with the fractions and .
The middle term of a Farey sequence ''F''''n'' is always ,
for ''n'' > 1. From this, we can relate the lengths of ''Fn'' and ''F''''n''−1 using Euler's totient function
In number theory, Euler's totient function counts the positive integers up to a given integer that are relatively prime to . It is written using the Greek letter phi as \varphi(n) or \phi(n), and may also be called Euler's phi function. In ot ...
:
:
Using the fact that , ''F''1, = 2, we can derive an expression for the length of ''Fn'':
:
where is the summatory totient.
We also have :
:
and by a Möbius inversion formula
In mathematics, the classic Möbius inversion formula is a relation between pairs of arithmetic functions, each defined from the other by sums over divisors. It was introduced into number theory in 1832 by August Ferdinand Möbius.
A large genera ...
:
:
where µ(''d'') is the number-theoretic Möbius function
The Möbius function is a multiplicative function in number theory introduced by the German mathematician August Ferdinand Möbius (also transliterated ''Moebius'') in 1832. It is ubiquitous in elementary and analytic number theory and most oft ...
, and is the floor function
In mathematics and computer science, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least int ...
.
The asymptotic behaviour of , ''Fn'', is :
:
The index of a fraction in the Farey sequence is simply the position that occupies in the sequence. This is of special relevance as it is used in an alternative formulation of the Riemann hypothesis
In mathematics, the Riemann hypothesis is the conjecture that the Riemann zeta function has its zeros only at the negative even integers and complex numbers with real part . Many consider it to be the most important unsolved problem in ...
, see below
Below may refer to:
*Earth
*Ground (disambiguation)
*Soil
*Floor
*Bottom (disambiguation)
Bottom may refer to:
Anatomy and sex
* Bottom (BDSM), the partner in a BDSM who takes the passive, receiving, or obedient role, to that of the top or ...
. Various useful properties follow:
:
:
:
:
:
The index of where and is the least common multiple
In arithmetic and number theory, the least common multiple, lowest common multiple, or smallest common multiple of two integers ''a'' and ''b'', usually denoted by lcm(''a'', ''b''), is the smallest positive integer that is divisible by bot ...
of the first numbers, , is given by:
:
Farey neighbours
Fractions which are neighbouring terms in any Farey sequence are known as a ''Farey pair'' and have the following properties.
If and are neighbours in a Farey sequence, with < , then their difference − is equal to . Since
:
this is equivalent to saying that
:.
Thus and are neighbours in ''F''5, and their difference is .
The converse is also true. If
:
for positive integers ''a'',''b'',''c'' and ''d'' with ''a'' < ''b'' and ''c'' < ''d'' then and will be neighbours in the Farey sequence of order max(''b,d'').
If has neighbours and in some Farey sequence, with
:
then is the mediant In music, the mediant (''Latin'': to be in the middle) is the third scale degree () of a diatonic scale, being the note halfway between the tonic and the dominant.Benward & Saker (2003), p.32. In the movable do solfège system, the mediant note i ...
of and – in other words,
:
This follows easily from the previous property, since if , then , , .
It follows that if and are neighbours in a Farey sequence then the first term that appears between them as the order of the Farey sequence is incremented is
:
which first appears in the Farey sequence of order .
Thus the first term to appear between and is , which appears in ''F''8.
The total number of Farey neighbour pairs in ''Fn'' is 2, ''Fn'', − 3.
The '' Stern–Brocot tree'' is a data structure showing how the sequence is built up from 0 (= ) and 1 (= ), by taking successive mediants.
Equivalent-area interpretation
Every consecutive pair of Farey rationals have an equivalent area of 1. See this by interpreting consecutive rationals ''r''1 = ''p''/''q'' and ''r''2 = ''p''′/''q''′ as vectors (''p'', ''q'') in the x–y plane. The area of ''A''(''p''/''q'', ''p''′/''q''′) is given by ''qp''′ − ''q''′''p''. As any added fraction in between two previous consecutive Farey sequence fractions is calculated as the mediant (⊕), then ''A''(''r''1, ''r''1 ⊕ ''r''2) = ''A''(''r''1, ''r''1) + ''A''(''r''1, ''r''2) = ''A''(''r''1, ''r''2) = 1 (since ''r''1 = 1/0 and ''r''2 = 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
In mathematics, a continued fraction is an expression (mathematics), expression obtained through an iterative process of representing a number as the sum of its integer part and the multiplicative inverse, reciprocal of another number, then writ ...
expansions. Every fraction has two continued fraction expansions — in one the final term is 1; in the other the final term is greater than 1. If , which first appears in Farey sequence ''Fq'', has continued fraction expansions
: 1, ''a''2, ..., ''a''''n'' − 1, ''a''''n'', 1">; ''a''1, ''a''2, ..., ''a''''n'' − 1, ''a''''n'', 1: 1, ''a''2, ..., ''a''''n'' − 1, ''a''''n'' + 1">; ''a''1, ''a''2, ..., ''a''''n'' − 1, ''a''''n'' + 1
then the nearest neighbour of in ''Fq'' (which will be its neighbour with the larger denominator) has a continued fraction expansion
: 1, ''a''2, ..., ''a''''n''">; ''a''1, ''a''2, ..., ''a''''n''
and its other neighbour has a continued fraction expansion
: 1, ''a''2, ..., ''a''''n'' − 1">; ''a''1, ''a''2, ..., ''a''''n'' − 1
For example, has the two continued fraction expansions and , and its neighbours in ''F''8 are , which can be expanded as ; and , which can be expanded as .
Farey fractions and the least common multiple
The lcm can be expressed as the products of Farey fractions as
:
where is the second Chebyshev function
In mathematics, the Chebyshev function is either a scalarising function (Tchebycheff function) or one of two related functions. The first Chebyshev function or is given by
:\vartheta(x)=\sum_ \ln p
where \ln denotes the natural logarithm, w ...
.
Farey fractions and the greatest common divisor
Since the Euler's totient function
In number theory, Euler's totient function counts the positive integers up to a given integer that are relatively prime to . It is written using the Greek letter phi as \varphi(n) or \phi(n), and may also be called Euler's phi function. In ot ...
is directly connected to the gcd so is the number of elements in ''Fn'',
:
For any 3 Farey fractions , and the following identity between the gcd's of the 2x2 matrix determinant
In mathematics, the determinant is a scalar value that is a function of the entries of a square matrix. It characterizes some properties of the matrix and the linear map represented by the matrix. In particular, the determinant is nonzero if an ...
s in absolute value holds:
:
Applications
Farey sequences are very useful to find rational approximations of irrational numbers. For example, the construction by Eliahou of a lower bound on the length of non-trivial cycles in the 3''x''+1 process uses Farey sequences to calculate a continued fraction expansion of the number log2(3).
In physical systems with resonance phenomena, Farey sequences provide a very elegant and efficient method to compute resonance locations in 1D and 2D.
Farey sequences are prominent in studies of any-angle path planning
Any-angle path planning algorithms are a subset of pathfinding algorithms that search for a path between two points in space and allow the turns in the path to have any angle. The result is a path that goes directly toward the goal and has relative ...
on square-celled grids, for example in characterizing their computational complexity or optimality. The connection can be considered in terms of ''r''-constrained paths, namely paths made up of line segments that each traverse at most rows and at most columns of cells. Let be the set of vectors such that , , and , are coprime. Let be the result of reflecting in the line . Let . Then any ''r''-constrained path can be described as a sequence of vectors from . There is a bijection between and the Farey sequence of order given by mapping to .
Ford circles
There is a connection between Farey sequence and Ford circle
In mathematics, a Ford circle is a circle with center at (p/q,1/(2q^2)) and radius 1/(2q^2), where p/q is an irreducible fraction, i.e. p and q are coprime integers. Each Ford circle is tangent to the horizontal axis y=0, and any two Ford circles ...
s.
For every fraction (in its lowest terms) there is a Ford circle C[], which is the circle with radius 1/(2''q''2) and centre at (, ). Two Ford circles for different fractions are either Disjoint sets, disjoint or they are tangent to one another—two Ford circles never intersect. If 0 < < 1 then the Ford circles that are tangent to C[] are precisely the Ford circles for fractions that are neighbours of in some Farey sequence.
Thus ''C''[] is tangent to ''C''[], ''C''[], ''C''[], ''C''[], etc.
Ford circles appear also in the Apollonian gasket (0,0,1,1). The picture below illustrates this together with Farey resonance lines.
Riemann hypothesis
Farey sequences are used in two equivalent formulations of the Riemann hypothesis
In mathematics, the Riemann hypothesis is the conjecture that the Riemann zeta function has its zeros only at the negative even integers and complex numbers with real part . Many consider it to be the most important unsolved problem in ...
. Suppose the terms of are . Define , in other words is the difference between the ''k''th term of the ''n''th Farey sequence, and the ''k''th member of a set of the same number of points, distributed evenly on the unit interval. In 1924 Jérôme Franel
Jérôme Franel (1859–1939) was a Swiss mathematician who specialised in analytic number theory. He is mainly known through a 1924 paper, in which he establishes the equivalence of the Riemann hypothesis to a statement on the size of the discre ...
proved that the statement
:
is equivalent to the Riemann hypothesis, and then Edmund Landau
Edmund Georg Hermann Landau (14 February 1877 – 19 February 1938) was a German mathematician who worked in the fields of number theory and complex analysis.
Biography
Edmund Landau was born to a Jewish family in Berlin. His father was Leopold ...
remarked (just after Franel's paper) that the statement
:
is also equivalent to the Riemann hypothesis.
Other sums involving Farey fractions
The sum of all Farey fractions of order ''n'' is half the number of elements:
:
The sum of the denominators in the Farey sequence is twice the sum of the numerators and relates to Euler's totient function:
:
which was conjectured by Harold L. Aaron in 1962 and demonstrated by Jean A. Blake in 1966. A one line proof of the Harold L. Aaron conjecture is as follows.
The sum of the numerators is . The sum of denominators is
. The quotient of the first sum by the second sum is .
Let ''b''''j'' be the ordered denominators of ''F''''n'', then:
:
and
:
Let ''a''''j''/''b''''j'' the ''j''th Farey fraction in ''F''''n'', then
:
which is demonstrated in. Also according to this reference the term inside the sum can be expressed in many different ways:
:
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
:
The Mertens function
In number theory, the Mertens function is defined for all positive integers ''n'' as
: M(n) = \sum_^n \mu(k),
where \mu(k) is the Möbius function. The function is named in honour of Franz Mertens. This definition can be extended to positive r ...
can be expressed as a sum over Farey fractions as
: where is the Farey sequence of order ''n''.
This formula is used in the proof of the Franel–Landau theorem.
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 and are the two given entries, and is the unknown next entry, then = . Since is in lowest terms, there must be an integer ''k'' such that ''kc'' = ''a'' + ''p'' and ''kd'' = ''b'' + ''q'', giving ''p'' = ''kc'' − ''a'' and ''q'' = ''kd'' − ''b''. If we consider ''p'' and ''q'' to be functions of ''k'', then
:
so the larger ''k'' gets, the closer gets to .
To give the next term in the sequence ''k'' must be as large as possible, subject to ''kd'' − ''b'' ≤ ''n'' (as we are only considering numbers with denominators not greater than ''n''), so ''k'' is the greatest integer ≤ . Putting this value of ''k'' back into the equations for ''p'' and ''q'' gives
:
:
This is implemented in Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
as follows:
def farey_sequence(n: int, descending: bool = False) -> None:
"""Print the n'th Farey sequence. Allow for either ascending or descending."""
(a, b, c, d) = (0, 1, 1, n)
if descending:
(a, c) = (1, n - 1)
print("/".format(a, b))
while (c <= n and not descending) or (a > 0 and descending):
k = (n + b) // d
(a, b, c, d) = (c, d, k * c - a, k * d - b)
print("/".format(a, b))
Brute-force searches for solutions to Diophantine equation
In mathematics, a Diophantine equation is an equation, typically a polynomial equation in two or more unknowns with integer coefficients, such that the only solutions of interest are the integer ones. A linear Diophantine equation equates to a c ...
s 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.
See also
* ABACABA pattern
The ABACABA pattern is a recursive fractal pattern that shows up in many places in the real world (such as in geometry, art, music, poetry, number systems, literature and higher dimensions). Patterns often show a DABACABA type subset. ''AA'', ...
* Stern–Brocot tree
* Euler's totient function
In number theory, Euler's totient function counts the positive integers up to a given integer that are relatively prime to . It is written using the Greek letter phi as \varphi(n) or \phi(n), and may also be called Euler's phi function. In ot ...
Footnotes
References
Further reading
*
* — 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).
* — reviews the isomorphisms of the Stern-Brocot Tree.
* — reviews connections between Farey Fractions and Fractals.
*
*
Errata + Code
External links
*
*
*
*
*
*
*
*
* Archived a
Ghostarchive
and th
Wayback Machine
{{Authority control
Fractions (mathematics)
Number theory
Sequences and series