In mathematics, the Farey sequence of order n is the sequence of completely reduced fractions, either between 0 and 1, or without this restriction, [a] which when in lowest terms 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 0/1, and ends with the value 1, denoted by the fraction 1/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. [2]
The Farey sequences of orders 1 to 8 are :
Centered |
---|
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 } |
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} |
Plotting the numerators versus the denominators of a Farey sequence gives a shape like the one to the right, shown for F6.
Reflecting this shape around the diagonal and main axes generates the Farey sunburst, shown below. The Farey sunburst of order n connects the visible integer grid points from the origin in the square of side 2n, centered at the origin. Using Pick's theorem, the area of the sunburst is 4(|Fn|− 1), where |Fn| is the number of fractions in Fn.
Farey sequences are named after the British geologist John Farey, Sr., whose letter about these sequences was published in the Philosophical Magazine in 1816. 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. [4] Thus it was a historical accident that linked Farey's name with these sequences. This is an example of Stigler's law of eponymy.
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 Fn−1 and also contains an additional fraction for each number that is less than n and coprime to n. Thus F6 consists of F5 together with the fractions 1/6 and 5/6.
The middle term of a Farey sequence Fn is always 1/2, for n > 1. From this, we can relate the lengths of Fn and Fn−1 using Euler's totient function φ(n):
Using the fact that |F1| = 2, we can derive an expression for the length of Fn: [5]
where Φ(n) is the summatory totient.
We also have : and by a Möbius inversion formula : where μ(d) is the number-theoretic Möbius function, and is the floor function.
The asymptotic behaviour of |Fn| is :
The number of Farey fractions with denominators equal to k in Fn is given by φ(k) when k≤n and zero otherwise. Concerning the numerators one can define the function that returns the number of Farey fractions with numerators equal to h in Fn. This function has some interesting properties as [6]
In particular, the property in the third line above implies and, further, The latter means that, for Farey sequences of even order n, the number of fractions with numerators equal to n/2 is the same as the number of fractions with denominators equal to n/2, that 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, see below. Various useful properties follow:
The index of 1/k where n/i+1 < k≤n/i and n is the least common multiple of the first i numbers, n = lcm([2, i]), is given by: [7]
Fractions which are neighbouring terms in any Farey sequence are known as a Farey pair and have the following properties.
If a/b and c/d are neighbours in a Farey sequence, with a/b < c/d, then their difference c/d−a/b is equal to 1/bd. Since
this is equivalent to saying that
Thus 1/3 and 2/5 are neighbours in F5, and their difference is 1/15.
The converse is also true. If
for positive integers a, b, c, d with a < b and c < d, then a/b and c/d will be neighbours in the Farey sequence of order max(b,d).
If p/q has neighbours a/b and c/d in some Farey sequence, with a/b < p/q < c/d, then p/q is the mediant of a/b and c/d– in other words,
This follows easily from the previous property, since if
It follows that if a/b and 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
which first appears in the Farey sequence of order b + d.
Thus the first term to appear between 1/3 and 2/5 is 3/8, which appears in F8.
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 (= 0/1) and 1 (= 1/1), by taking successive mediants.
Every consecutive pair of Farey rationals have an equivalent area of 1. [8] See this by interpreting consecutive rationals as vectors (p, q) in the xy-plane. The area is given by As any added fraction in between two previous consecutive Farey sequence fractions is calculated as the mediant (⊕), then (since r1 = 1/0 and r2 = 0/1, its area must be 1).
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 p/q, which first appears in Farey sequence Fq, has the continued fraction expansions
then the nearest neighbour of p/q in Fq (which will be its neighbour with the larger denominator) has a continued fraction expansion
and its other neighbour has a continued fraction expansion
For example, 3/8 has the two continued fraction expansions [0; 2, 1, 1, 1] and [0; 2, 1, 2], and its neighbours in F8 are 2/5, which can be expanded as [0; 2, 1, 1]; and 1/3, which can be expanded as [0; 2, 1].
The lcm can be expressed as the products of Farey fractions as
where ψ(N) is the second Chebyshev function. [9] [10]
Since the Euler's totient function is directly connected to the gcd so is the number of elements in Fn,
For any 3 Farey fractions a/b, c/d, e/f the following identity between the gcd's of the 2x2 matrix determinants in absolute value holds: [11]
Farey sequences are very useful to find rational approximations of irrational numbers. [12] For example, the construction by Eliahou [13] 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 log2(3).
In physical systems with resonance phenomena, Farey sequences provide a very elegant and efficient method to compute resonance locations in 1D [14] and 2D. [15]
Farey sequences are prominent in studies of any-angle path planning on square-celled grids, for example in characterizing their computational complexity [16] or optimality. [17] The connection can be considered in terms of r-constrained paths, namely paths made up of line segments that each traverse at most r rows and at most r columns of cells. Let Q be the set of vectors (q, p) such that , , and p, q are coprime. Let Q* be the result of reflecting Q in the line y = x. Let . Then any r-constrained path can be described as a sequence of vectors from S. There is a bijection between Q and the Farey sequence of order r given by (q, p) mapping to .
There is a connection between Farey sequence and Ford circles.
For every fraction p/q (in its lowest terms) there is a Ford circle C[p/q], which is the circle with radius and centre at Two Ford circles for different fractions are either disjoint or they are tangent to one another—two Ford circles never intersect. If 0 < p/q < 1 then the Ford circles that are tangent to C[p/q] are precisely the Ford circles for fractions that are neighbours of p/q in some Farey sequence.
Thus C[2/5] is tangent to C[1/2], C[1/3], C[3/7], C[3/8], etc.
Ford circles appear also in the Apollonian gasket (0,0,1,1). The picture below illustrates this together with Farey resonance lines. [18]
Farey sequences are used in two equivalent formulations of the Riemann hypothesis. Suppose the terms of Fn are Define in other words is the difference between the kth term of the nth Farey sequence, and the kth member of a set of the same number of points, distributed evenly on the unit interval. In 1924 Jérôme Franel [19] proved that the statement
is equivalent to the Riemann hypothesis, and then Edmund Landau [20] remarked (just after Franel's paper) that the statement
is also equivalent to the Riemann hypothesis.
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. [21] 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 1/2.
Let bj be the ordered denominators of Fn, then: [22]
and
Let the jth Farey fraction in Fn, then
which is demonstrated in. [23] 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 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. [24]
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 a/b and c/d are the two given entries, and p/q is the unknown next entry, then c/d = a + p/b + q. Since c/d 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 p/q gets to c/d.
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 ≤ n + b/d. Putting this value of k back into the equations for p and q gives
This is implemented in Python as follows:
fromfractionsimportFractionfromcollections.abcimportGeneratordeffarey_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,nifdescending:a,c=1,n-1yieldFraction(a,b)while0<=c<=n:k=(n+b)//da,b,c,d=c,d,k*c-a,k*d-byieldFraction(a,b)if__name__=="__main__":importdoctestdoctest.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. [25]
In mathematics, the Fibonacci sequence is a sequence in which each number is the sum of the two preceding ones. Numbers that are part of the Fibonacci sequence are known as Fibonacci numbers, commonly denoted Fn . Many writers begin the sequence with 0 and 1, although some authors start it from 1 and 1 and some from 1 and 2. Starting from 0 and 1, the sequence begins
In mathematics, two quantities are in the golden ratio if their ratio is the same as the ratio of their sum to the larger of the two quantities. Expressed algebraically, for quantities and with , is in a golden ratio to if
In number theory, a multiplicative function is an arithmetic function f(n) of a positive integer n with the property that f(1) = 1 and whenever a and b are coprime.
In number theory, Euler's totient function counts the positive integers up to a given integer n that are relatively prime to n. It is written using the Greek letter phi as or , and may also be called Euler's phi function. In other words, it is the number of integers k in the range 1 ≤ k ≤ n for which the greatest common divisor gcd(n, k) is equal to 1. The integers k of this form are sometimes referred to as totatives of n.
A Fourier series is an expansion of a periodic function into a sum of trigonometric functions. The Fourier series is an example of a trigonometric series, but not all trigonometric series are Fourier series. By expressing a function as a sum of sines and cosines, many problems involving the function become easier to analyze because trigonometric functions are well understood. For example, Fourier series were first used by Joseph Fourier to find solutions to the heat equation. This application is possible because the derivatives of trigonometric functions fall into simple patterns. Fourier series cannot be used to approximate arbitrary functions, because most functions have infinitely many terms in their Fourier series, and the series do not always converge. Well-behaved functions, for example smooth functions, have Fourier series that converge to the original function. The coefficients of the Fourier series are determined by integrals of the function multiplied by trigonometric functions, described in Common forms of the Fourier series below.
Noether's theorem states that every continuous symmetry of the action of a physical system with conservative forces has a corresponding conservation law. This is the first of two theorems published by mathematician Emmy Noether in 1918. The action of a physical system is the integral over time of a Lagrangian function, from which the system's behavior can be determined by the principle of least action. This theorem only applies to continuous and smooth symmetries of physical space.
In mathematics, a generating function is a representation of an infinite sequence of numbers as the coefficients of a formal power series. Generating functions are often expressed in closed form, by some expression involving operations on the formal series.
In linear algebra, the Cayley–Hamilton theorem states that every square matrix over a commutative ring satisfies its own characteristic equation.
In physics, Hamiltonian mechanics is a reformulation of Lagrangian mechanics that emerged in 1833. Introduced by Sir William Rowan Hamilton, Hamiltonian mechanics replaces (generalized) velocities used in Lagrangian mechanics with (generalized) momenta. Both theories provide interpretations of classical mechanics and describe the same physical phenomena.
The Lucas sequence is an integer sequence named after the mathematician François Édouard Anatole Lucas (1842–1891), who studied both that sequence and the closely related Fibonacci sequence. Individual numbers in the Lucas sequence are known as Lucas numbers. Lucas numbers and Fibonacci numbers form complementary instances of Lucas sequences.
In mathematics, theta functions are special functions of several complex variables. They show up in many topics, including Abelian varieties, moduli spaces, quadratic forms, and solitons. As Grassmann algebras, they appear in quantum field theory.
In mathematics, the Gauss–Kuzmin–Wirsing operator is the transfer operator of the Gauss map that takes a positive number to the fractional part of its reciprocal. It is named after Carl Gauss, Rodion Kuzmin, and Eduard Wirsing. It occurs in the study of continued fractions; it is also related to the Riemann zeta function.
In mathematics, the mediant of two fractions, generally made up of four positive integers
In mathematics, the resultant of two polynomials is a polynomial expression of their coefficients that is equal to zero if and only if the polynomials have a common root, or, equivalently, a common factor. In some older texts, the resultant is also called the eliminant.
In algebra, the Bring radical or ultraradical of a real number a is the unique real root of the polynomial
In mathematics, in the area of wavelet analysis, a refinable function is a function which fulfils some kind of self-similarity. A function is called refinable with respect to the mask if
The Rogers–Ramanujan continued fraction is a continued fraction discovered by Rogers (1894) and independently by Srinivasa Ramanujan, and closely related to the Rogers–Ramanujan identities. It can be evaluated explicitly for a broad class of values of its argument.
In mathematics, Ramanujan's master theorem, named after Srinivasa Ramanujan, is a technique that provides an analytic expression for the Mellin transform of an analytic function.
In mathematics, infinite compositions of analytic functions (ICAF) offer alternative formulations of analytic continued fractions, series, products and other infinite expansions, and the theory evolving from such compositions may shed light on the convergence/divergence of these expansions. Some functions can actually be expanded directly as infinite compositions. In addition, it is possible to use ICAF to evaluate solutions of fixed point equations involving infinite expansions. Complex dynamics offers another venue for iteration of systems of functions rather than a single function. For infinite compositions of a single function see Iterated function. For compositions of a finite number of functions, useful in fractal theory, see Iterated function system.
In modern valence bond (VB) theory calculations, Chirgwin–Coulson weights are the relative weights of a set of possible VB structures of a molecule. Related methods of finding the relative weights of valence bond structures are the Löwdin and the inverse weights.