|
|
Line 1: |
Line 1: |
| [[Image:Farey diagram square.png|thumb|Farey diagram to ''F''<sub>5</sub>.]]
| | I'm a 39 years old, married and study at the university (Environmental Management).<br>In my spare time I teach myself English. I have been there and look forward to go there sometime in the future. I love to read, preferably on my ipad. I like to watch Modern Family and [http://wordpress.org/search/Arrested+Development Arrested Development] as well as documentaries about nature. I enjoy Running.<br><br>Also visit my website - [http://Www.sovet.ca/67800/how-to-get-free-fifa-15-coins Fifa 15 Coin Generator] |
| [[Image:Farey diagram horizontal arc.png|thumb|Farey diagram to ''F''<sub>5</sub>.]]
| |
| [[Image:Farey sequence denominators.png|thumb|Symmetrical pattern made by the denominators of the Farey sequence, ''F''<sub>8</sub>.]]
| |
| | |
| In [[mathematics]], the '''Farey sequence''' of order ''n'' is the [[sequence]] of completely reduced [[vulgar fraction|fraction]]s between 0 and 1 which, when [[in lowest terms]], have [[denominator]]s less than or equal to ''n'', arranged in order of increasing size.
| |
| | |
| Each Farey sequence starts with the value 0, denoted by the fraction <sup>0</sup>⁄<sub>1</sub>, and ends with the value 1, denoted by the fraction <sup>1</sup>⁄<sub>1</sub> (although some authors omit these terms).
| |
| | |
| A Farey sequence is sometimes called a Farey [[series (mathematics)|series]], which is not strictly correct, because the terms are not summed.
| |
| | |
| ==Examples==
| |
| The Farey sequences of orders 1 to 8 are :
| |
| :''F''<sub>1</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|1}} }
| |
| :''F''<sub>2</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|1|1}} }
| |
| :''F''<sub>3</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|1|1}} }
| |
| :''F''<sub>4</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|1|1}} }
| |
| :''F''<sub>5</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|5}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|2|5}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|3|5}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|4|5}}<sub>,</sub> {{sfrac|1|1}} }
| |
| :''F''<sub>6</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|6}}<sub>,</sub> {{sfrac|1|5}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|2|5}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|3|5}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|4|5}}<sub>,</sub> {{sfrac|5|6}}<sub>,</sub> {{sfrac|1|1}} }
| |
| :''F''<sub>7</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|7}}<sub>,</sub> {{sfrac|1|6}}<sub>,</sub> {{sfrac|1|5}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|2|7}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|2|5}}<sub>,</sub> {{sfrac|3|7}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|4|7}}<sub>,</sub> {{sfrac|3|5}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|5|7}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|4|5}}<sub>,</sub> {{sfrac|5|6}}<sub>,</sub> {{sfrac|6|7}}<sub>,</sub> {{sfrac|1|1}} }
| |
| :''F''<sub>8</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|8}}<sub>,</sub> {{sfrac|1|7}}<sub>,</sub> {{sfrac|1|6}}<sub>,</sub> {{sfrac|1|5}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|2|7}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|3|8}}<sub>,</sub> {{sfrac|2|5}}<sub>,</sub> {{sfrac|3|7}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|4|7}}<sub>,</sub> {{sfrac|3|5}}<sub>,</sub> {{sfrac|5|8}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|5|7}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|4|5}}<sub>,</sub> {{sfrac|5|6}}<sub>,</sub> {{sfrac|6|7}}<sub>,</sub> {{sfrac|7|8}}<sub>,</sub> {{sfrac|1|1}} }
| |
| | |
| {{Collapse|1=
| |
| <div class="center" style="width:auto; margin-left:auto; margin-right:auto;">''F''<sub>1</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|1}} }</div>
| |
| <div class="center" style="width:auto; margin-left:auto; margin-right:auto;">''F''<sub>2</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|1|1}} }</div>
| |
| <div class="center" style="width:auto; margin-left:auto; margin-right:auto;">''F''<sub>3</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|1|1}} }</div>
| |
| <div class="center" style="width:auto; margin-left:auto; margin-right:auto;">''F''<sub>4</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|1|1}} }</div>
| |
| <div class="center" style="width:auto; margin-left:auto; margin-right:auto;">''F''<sub>5</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|5}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|2|5}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|3|5}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|4|5}}<sub>,</sub> {{sfrac|1|1}} }</div>
| |
| <div class="center" style="width:auto; margin-left:auto; margin-right:auto;">''F''<sub>6</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|6}}<sub>,</sub> {{sfrac|1|5}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|2|5}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|3|5}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|4|5}}<sub>,</sub> {{sfrac|5|6}}<sub>,</sub> {{sfrac|1|1}} }</div>
| |
| <div class="center" style="width:auto; margin-left:auto; margin-right:auto;">''F''<sub>7</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|7}}<sub>,</sub> {{sfrac|1|6}}<sub>,</sub> {{sfrac|1|5}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|2|7}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|2|5}}<sub>,</sub> {{sfrac|3|7}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|4|7}}<sub>,</sub> {{sfrac|3|5}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|5|7}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|4|5}}<sub>,</sub> {{sfrac|5|6}}<sub>,</sub> {{sfrac|6|7}}<sub>,</sub> {{sfrac|1|1}} }</div>
| |
| <div class="center" style="width:auto; margin-left:auto; margin-right:auto;">''F''<sub>8</sub> = { {{sfrac|0|1}}<sub>,</sub> {{sfrac|1|8}}<sub>,</sub> {{sfrac|1|7}}<sub>,</sub> {{sfrac|1|6}}<sub>,</sub> {{sfrac|1|5}}<sub>,</sub> {{sfrac|1|4}}<sub>,</sub> {{sfrac|2|7}}<sub>,</sub> {{sfrac|1|3}}<sub>,</sub> {{sfrac|3|8}}<sub>,</sub> {{sfrac|2|5}}<sub>,</sub> {{sfrac|3|7}}<sub>,</sub> {{sfrac|1|2}}<sub>,</sub> {{sfrac|4|7}}<sub>,</sub> {{sfrac|3|5}}<sub>,</sub> {{sfrac|5|8}}<sub>,</sub> {{sfrac|2|3}}<sub>,</sub> {{sfrac|5|7}}<sub>,</sub> {{sfrac|3|4}}<sub>,</sub> {{sfrac|4|5}}<sub>,</sub> {{sfrac|5|6}}<sub>,</sub> {{sfrac|6|7}}<sub>,</sub> {{sfrac|7|8}}<sub>,</sub> {{sfrac|1|1}} }</div>
| |
| |2=Centered|bg=#F0F2F5}}
| |
| | |
| {{Collapse|1=
| |
| <div>
| |
| 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}
| |
| </div>
| |
| |2=Sorted|bg=#F0F2F5}}
| |
| | |
| ==History==
| |
| :''The history of 'Farey series' is very curious'' — Hardy & Wright (1979) Chapter III<ref>[[G. H. Hardy|Hardy, G.H.]] & [[E. M. Wright|Wright, E.M.]] (1979) ''An Introduction to the Theory of Numbers'' (Fifth Edition). Oxford University Press. ISBN 0-19-853171-0</ref>
| |
| | |
| :''... 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) Chapter XVI<ref name=Beiler>Beiler, Albert H. (1964) ''Recreations in the Theory of Numbers'' (Second Edition). Dover. ISBN 0-486-21096-0. Cited in [http://www.cut-the-knot.org/blue/FareyHistory.shtml Farey Series, A Story] at [[Cut-the-Knot]]</ref>
| |
| | |
| Farey sequences are named after the [[United Kingdom|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 (mathematics)|mediant]] of its neighbours. Farey's letter was read by [[Cauchy]], who provided a proof in his ''Exercises 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.<ref name=Beiler/> 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==
| |
| [[File:Farey diagram circle packing.png|thumb]]
| |
| ===Sequence length===
| |
| The Farey sequence of order ''n'' contains all of the members of the Farey sequences of lower orders. In particular ''F<sub>n</sub>'' contains all of the members of ''F''<sub>''n''−1</sub>, and also contains an additional fraction for each number that is less than ''n'' and [[coprime]] to ''n''. Thus ''F''<sub>6</sub> consists of ''F''<sub>5</sub> together with the fractions {{sfrac|1|6}} and {{sfrac|5|6}}. The middle term of a Farey sequence ''F''<sub>''n''</sub> is always {{sfrac|1|2}}, for ''n'' > 1.
| |
| | |
| From this, we can relate the lengths of ''F<sub>n</sub>'' and ''F''<sub>''n''−1</sub> using [[Euler's totient function]] φ(''n'') :
| |
| | |
| :<math>|F_n| = |F_{n-1}| + \varphi(n).</math>
| |
| | |
| Using the fact that |''F''<sub>1</sub>| = 2, we can derive an expression for the length of ''F<sub>n</sub>'' :
| |
| | |
| :<math>|F_n| = 1 + \sum_{m=1}^n \varphi(m).</math>
| |
| | |
| We also have:
| |
| | |
| :<math>|F_n| = \frac{1}{2}\left(3+\sum_{d=1}^n\mu(d)\left\lfloor\tfrac{n}{d}\right\rfloor^2\right),</math>
| |
| where µ(''d'') is the number-theoretic [[Möbius function]], and
| |
| | |
| :<math>|F_n| = \frac{1}{2}(n+3)n-\sum_{d=2}^n|F_{\lfloor n/d\rfloor}|,</math>
| |
| by a [[Möbius inversion formula]].
| |
| | |
| The asymptotic behaviour of |''F<sub>n</sub>''| is :
| |
| | |
| :<math>|F_n| \sim \frac {3n^2}{\pi^2}.</math>
| |
| | |
| ===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 {{sfrac|''a''|''b''}} and {{sfrac|''c''|''d''}} are neighbours in a Farey sequence, with {{sfrac|''a''|''b''}} < {{sfrac|''c''|''d''}}, then their difference {{sfrac|''c''|''d''}} − {{sfrac|''a''|''b''}} is equal to {{sfrac|1|''bd''}}. Since
| |
| | |
| :<math>\frac{c}{d} - \frac{a}{b} = \frac{bc - ad}{bd},</math>
| |
| | |
| this is equivalent to saying that
| |
| | |
| :''bc'' − ''ad'' = 1.
| |
| | |
| Thus {{sfrac|1|3}} and {{sfrac|2|5}} are neighbours in ''F''<sub>5</sub>, and their difference is {{sfrac|1|15}}.
| |
| | |
| The converse is also true. If
| |
| | |
| :''bc'' − ''ad'' = 1
| |
| | |
| for positive integers ''a'',''b'',''c'' and ''d'' with ''a'' < ''b'' and ''c'' < ''d'' then {{sfrac|''a''|''b''}} and {{sfrac|''c''|''d''}} will be neighbours in the Farey sequence of order max(''b,d'').
| |
| | |
| If {{sfrac|''p''|''q''}} has neighbours {{sfrac|''a''|''b''}} and {{sfrac|''c''|''d''}} in some Farey sequence, with
| |
| | |
| :{{sfrac|''a''|''b''}} < {{sfrac|''p''|''q''}} < {{sfrac|''c''|''d''}}
| |
| | |
| then {{sfrac|''p''|''q''}} is the [[mediant (mathematics)|mediant]] of {{sfrac|''a''|''b''}} and {{sfrac|''c''|''d''}} — in other words,
| |
| | |
| :<math>\frac{p}{q} = \frac{a + c}{b + d}.</math>
| |
| | |
| This follows easily from the previous property, since if ''bp''-''aq'' = ''qc''-''pd'' = 1, then ''bp''+''pd'' = ''qc''+''aq'', ''p''(''b''+''d'')=''q''(''a''+''c''), {{sfrac|''p''|''q''}} = {{sfrac|''a''+''c''|''b''+''d''}}
| |
| | |
| It follows that if {{sfrac|''a''|''b''}} and {{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 increased is
| |
| | |
| :<math>\frac{a+c}{b+d},</math>
| |
| | |
| which first appears in the Farey sequence of order ''b'' + ''d''.
| |
| | |
| Thus the first term to appear between {{sfrac|1|3}} and {{sfrac|2|5}} is {{sfrac|3|8}}, which appears in ''F''<sub>8</sub>.
| |
| | |
| The ''[[Stern-Brocot tree]]'' is a data structure showing how the sequence is built up from 0 (= {{sfrac|0|1}}) and 1 (= {{sfrac|1|1}}), by taking successive mediants.
| |
| | |
| 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 than 1. If {{sfrac|''p''|''q''}}, which first appears in Farey sequence ''F<sub>q</sub>'', has continued fraction expansions
| |
| | |
| :[0; ''a''<sub>1</sub>, ''a''<sub>2</sub>, …, ''a''<sub>''n'' − 1</sub>, ''a''<sub>''n''</sub>, 1]
| |
| :[0; ''a''<sub>1</sub>, ''a''<sub>2</sub>, …, ''a''<sub>''n'' − 1</sub>, ''a''<sub>''n''</sub> + 1]
| |
| | |
| then the nearest neighbour of {{sfrac|''p''|''q''}} in ''F<sub>q</sub>'' (which will be its neighbour with the larger denominator) has a continued fraction expansion
| |
| | |
| :[0; ''a''<sub>1</sub>, ''a''<sub>2</sub>, …, ''a''<sub>''n''</sub>]
| |
| | |
| and its other neighbour has a continued fraction expansion
| |
| | |
| :[0; ''a''<sub>1</sub>, ''a''<sub>2</sub>, …, ''a''<sub>''n'' − 1</sub>]
| |
| | |
| Thus {{sfrac|3|8}} has the two continued fraction expansions [0; 2, 1, 1, 1] and [0; 2, 1, 2], and its neighbours in ''F<sub>8</sub>'' are {{sfrac|2|5}}, which can be expanded as [0; 2, 1, 1]; and {{sfrac|1|3}}, which can be expanded as [0; 2, 1].
| |
| | |
| ===Applications===
| |
| Farey sequences are very useful to find rational approximations of irrational numbers [http://nrich.maths.org/6596].
| |
| | |
| In physics systems featuring resonance phenomena Farey sequences provide a very elegant and efficient method to compute resonance locations in 1D <ref>A. Zhenhua Li, W.G. Harter, "Quantum Revivals of Morse Oscillators and Farey-Ford Geometry", arXiv:1308.4470v1
| |
| </ref> and 2D <ref>http://prst-ab.aps.org/abstract/PRSTAB/v17/i1/e014001</ref>
| |
| | |
| ===Ford circles===
| |
| [[File:Circumferències de Ford.svg|right|thumb|Ford circles.]]
| |
| | |
| There is a connection between Farey sequence and [[Ford circle]]s.
| |
| | |
| For every fraction ''p''/''q'' (in its lowest terms) there is a Ford circle C[''p''/''q''], which is the circle with radius 1/(2''q''<sup>2</sup>) and centre at (''p''/''q'', 1/(2''q''<sup>2</sup>)). 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 < ''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.
| |
| | |
| ===Riemann hypothesis===
| |
| Farey sequences are used in two equivalent formulations of the [[Riemann hypothesis]]. Suppose the terms of <math>F_n</math> are <math>\{a_{k,n} : k = 0, 1, \ldots, m_n\}</math>. Define <math>d_{k,n} = a_{k,n} - k/m_n</math>, in other words <math>d_{k,n}</math> 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]]<ref>"Les suites de Farey et le théorème des nombres premiers", Gött. Nachr. 1924, 198-201</ref> proved that the statement
| |
| | |
| : <math>\sum_{k=1}^{m_n} d_{k,n}^2 = \mathcal{O}(n^r)\quad\forall r>1</math>
| |
| | |
| is equivalent to the Riemann hypothesis, and then [[Edmund Landau]]<ref>"Bemerkungen zu der vorstehenden Abhandlung von Herrn Franel", Gött. Nachr. 1924, 202-206</ref> remarked (just after Franel's paper) that the statement
| |
| | |
| : <math>\sum_{k=1}^{m_n} |d_{k,n}| = \mathcal{O} (n^r)\quad\forall r>1/2</math> | |
| | |
| is also equivalent to the Riemann hypothesis.
| |
| | |
| ==Next term==
| |
| | |
| A surprisingly simple algorithm exists to generate the terms of ''F<sub>n</sub>'' 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 {{sfrac|''c''|''d''}} = {{sfrac|''a'' + ''p''|''b'' + ''q''}}. {{sfrac|''c''|''d''}} is in lowest terms, so there is an integer ''k'' such that ''kc'' = ''a'' + ''p'' and ''kd'' = ''b'' + ''q'', giving ''p'' = ''kc'' − ''a'' and ''q'' = ''kd'' − ''b''. The value of ''k'' must give a value of ''p''/''q'' which is as close as possible to ''c''/''d'', which implies that ''k'' must be as large as possible subject to ''kd'' − ''b'' = ''n'', so ''k'' is the greatest integer = {{sfrac|''n'' + ''b''|''d''}}. In other words, ''k'' = ''{{sfrac|n + b|d}}'', and
| |
| :<math> p = \left\lfloor\frac{n+b}{d}\right\rfloor c - a</math>
| |
| :<math> q = \left\lfloor\frac{n+b}{d}\right\rfloor d - b</math>
| |
| | |
| This is implemented in [[Python (programming language)|Python]] as:
| |
| <source lang="python">
| |
| def farey( n, asc=True ):
| |
| """Python function to print the nth Farey sequence, either ascending or descending."""
| |
| if asc:
| |
| a, b, c, d = 0, 1, 1 , n # (*)
| |
| else:
| |
| a, b, c, d = 1, 1, n-1 , n # (*)
| |
| print "%d/%d" % (a,b)
| |
| while (asc and c <= n) or (not asc and a > 0):
| |
| k = int((n + b)/d)
| |
| a, b, c, d = c, d, k*c - a, k*d - b
| |
| print "%d/%d" % (a,b)
| |
| </source>
| |
| | |
| Brute-force searches for solutions to [[Diophantine equation]]s in rationals can often take advantage of the Farey series (to search only reduced forms). The lines marked (*) can also be modified to include any two adjacent terms so as to generate terms only larger (or smaller) than a given term.<ref>Norman Routledge, "Computing Farey Series," ''[[The Mathematical Gazette]]'', Vol. ''' 92 ''' (No. 523), 55–62 (March 2008).</ref>
| |
| | |
| ==See also==
| |
| * [[Stern-Brocot tree]]
| |
| | |
| ==References==
| |
| <references/> | |
| | |
| ==Further reading==
| |
| * [[Allen Hatcher]], [http://www.math.cornell.edu/~hatcher/TN/TNpage.html Topology of Numbers]
| |
| * [[Ronald L. Graham]], [[Donald E. Knuth]], and [[Oren Patashnik]], ''Concrete Mathematics: A Foundation for Computer Science'', 2nd Edition (Addison-Wesley, Boston, 1989); in particular, Sec. 4.5 (pp. 115–123), Bonus Problem 4.61 (pp. 150, 523–524), Sec. 4.9 (pp. 133–139), Sec. 9.3, Problem 9.3.6 (pp. 462–463). ISBN 0-201-55802-5.
| |
| * Linas Vepstas. ''The Minkowski Question Mark, GL(2,Z), and the Modular Group.'' http://linas.org/math/chap-minkowski.pdf reviews the isomorphisms of the Stern-Brocot Tree.
| |
| * Linas Vepstas. ''Symmetries of Period-Doubling Maps.'' http://linas.org/math/chap-takagi.pdf reviews connections between Farey Fractions and Fractals.
| |
| * Scott B. Guthery, ''A Motif of Mathematics: History and Application of the Mediant and the Farey Sequence'', (Docent Press, Boston, 2010). ISBN 1-4538-1057-9.
| |
| * Cristian Cobeli and Alexandru Zaharescu, ''The Haros-Farey Sequence at Two Hundred Years. A Survey'', Acta Univ. Apulensis Math. Inform. no. 5 (2003) 1–38, [http://www.emis.de/journals/AUA/acta5/survey3.ps_pages1-20.pdf pp. 1–20] [http://www.emis.de/journals/AUA/acta5/survey3.ps_pages21-38.pdf pp. 21–38]
| |
| * A.O. Matveev, ''A Note on Boolean Lattices and Farey Sequences II'', [http://www.integers-ejcnt.org/vol8.html Integers 8(1), 2008, #A24]
| |
| * A.O. Matveev, ''Neighboring Fractions in Farey Subsequences'', [http://arxiv.org/pdf/0801.1981.pdf arXiv:0801.1981]
| |
| | |
| ==External links==
| |
| * Alexander Bogomolny. [http://www.cut-the-knot.org/blue/Farey.shtml Farey series] and [http://www.cut-the-knot.org/blue/Stern.shtml Stern-Brocot Tree] at [[Cut-the-Knot]]
| |
| * {{springer|title=Farey series|id=p/f038230}}
| |
| * {{MathWorld | urlname=Stern-BrocotTree | title=Stern-Brocot Tree}}
| |
| * [http://oeis.org/A005728 Farey Sequence] from [http://oeis.org/ The On-Line Encyclopedia of Integer Sequences].
| |
| | |
| [[Category:Fractions]]
| |
| [[Category:Number theory]]
| |
| [[Category:Sequences and series]]
| |