Talk:Farey sequence

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Mediants[edit]

The mediant link currently leads to a musical term.

Charles Matthews 11:58, 23 Feb 2004 (UTC)

Fixed. Dominus 14:21, 8 Feb 2005 (UTC)

Now added the mathematical sense. Please check it for correctness. -- Anon.

MEDIANTS:

Currently, the article reads that for the first p/q that is between a/b and c/d, p/q = (a+b)/(c+d). This is not true. The letters are somewhat confused. In actuality, the mediant p/q = (a+c)/(b+d). That is, the sum of the numerators over the sum of the denominators. This also makes it clearer why p/q will first appear in row b+d.

Ex.:

F(0) = 0/1 1/1 F(1) = 0/1 (0+1)/(1+1) = 1/2 1/1 F(2) = 0/1 1/3 1/2 2/3 1/1 etc.

The mediant method is the quickest way to construct the Farey sequence.

-- Barry Revzin --

link to the Riemann hypothesis[edit]

there is an interesting equivalent formulation of the Riemann hypothesis using Farey sequences which is mentioned in that article. Perhaps a cross-reference could be added here? Via strass 20:35, 8 August 2006 (UTC)[reply]

Sounds good to me; want to take a stab at it? --Piet Delport 20:22, 10 August 2006 (UTC)[reply]

Presumably the is using Big-oh notation? And it's as n goes to infinity? The article could be clearer on this... Thanks, Kier07 (talk) 20:25, 24 November 2009 (UTC)[reply]

Applications[edit]

Could anybody please add a section on the real-life applications of the Farey Sequence (e.g. the Fibonacci Sequence article with a section on the sequence's appearances in music, art, and nature). A section of this sort would be greatly appreciated.

-Jasmerrin

Neighbors[edit]

Maybe I'm missing something, but the section on Farey neighbors seems pretty foolish to me. Consider that in F1, the two terms present are neighbors. In F2, the first and third are neighbors of the 2nd term. Continue on, and by extension ALL simplified fraction are 'Farey neighbors,' regardless of what they are. What's the significance of that? —Preceding unsigned comment added by 24.208.253.57 (talk) 01:59, 23 April 2009 (UTC)[reply]

I think you have misunderstood the definition of Farey neighbours. Two fractions can only be Farey neighbours if they appear next to each other in some generation of the Farey sequence. 1/3 and 2/3 are not Farey neighbours because 1/2 will always be between them. 1/3 and 3/7 are not Farey neighbours because 2/5 is always between them. On the other hand, 1/3 and 2/7 are Farey neighbours because the first time that 2/7 apperas, in F7, it is right next to 1/3. Gandalf61 (talk) 10:59, 23 April 2009 (UTC)[reply]

I'm Confused..[edit]

So since a Farey sequence is:

In mathematics, the Farey sequence of order n is the sequence of completely reduced fractions between 0 and 1 which, when in lowest terms, have denominators less than or equal to n, arranged in order of increasing size.

What is the name of the sequence where we don't care to limit the denominators to n? Ie. What is the name of this sequence:

F1 = {01, 11}
F2 = {01, 12, 11}
F3 = {01, 13, 12, 23, 11}
F4 = {01, 14, 13, 25, 12, 35, 23, 34, 11}
F5 = {01, 15, 14, 27, 13, 38, 25, 37, 12, 47, 35, 58, 23, 57, 34, 45, 11}

Caimbul (talk) 20:12, 7 December 2009 (UTC)[reply]

Ah ha! I see. What this sequence does is the left hand side of a 'Stern-Brocot' tree, where each iteration adds a new row of a tree. http://www.cut-the-knot.org/blue/Stern.shtml is where I went to actually see this tree.. so Although Farey describes and will inevitably populate a Stern-Brocot tree, by ignoring the limit on Denominators, we actually get the SB tree values by row..

It would populate the right hand side as well.. Neat! Caimbul (talk) 20:39, 7 December 2009 (UTC)[reply]

In summary, the Stern-Brocot tree and the Farey sequences eventually include the same numbers: the (reduced) fractions between 0 and 1. They just include them at different times. Stern-Brocot is a sort of depth-first inclusion, whereas the Farey sequences are breadth first. Micro-Parallel (talk) 17:14, 5 June 2011 (UTC)[reply]

Next Term[edit]

There is a typo in the middle of the explanation which precedes the Python code: The right-hand side of the equation following "In other words" is missing a floor operation around the outside. I assume this could be added by imitating the coding of the next two equations, but if there is a way to do it which leaves the equation in the flowing text, that might be superior. In any case, I'll have to leave the changes to a more accomplished editor than I.. Micro-Parallel (talk) 17:01, 5 June 2011 (UTC)[reply]

Suggestion for Programmatic Representation[edit]

Could somebody add code for generating Farey sequnces in other programming languages – say, C++? BCG999 (talk) 15:51, 14 January 2013 (UTC)[reply]

You can download a C++ implementing Farey sequence generation at:

[1]

I extract the Farey class:

#include "farey_sequence.h"

FareySequence::FareySequence(int order) : order_(order)
{
	if ( order_ < 1 )
	{
		cout << "Error! Order must be greater than 0!\n";
		exit(0);
	}
	else 
	{
		sequence_.push_back(make_pair(0,1));
		sequence_.push_back(make_pair(1,order_));
		int numerator_1 , denominator_1 ; 
		int numerator_2 , denominator_2 ; 
		int numerator_3 , denominator_3 ; 
		int factor;
		numerator_1   = sequence_[0].first;
		denominator_1 = sequence_[0].second;
		numerator_2   = sequence_[1].first;
		denominator_2 = sequence_[1].second;
		numerator_3   = numerator_2;
		denominator_3 = denominator_2;
		while ( (numerator_3 != 1) || (denominator_3 != 1) )
		{
			factor = int(floor( double(order_ + denominator_1) / (de
nominator_2) ));
			numerator_3 = factor * numerator_2 - numerator_1;
			denominator_3 = factor * denominator_2 - denominator_1;
			sequence_.push_back(make_pair(numerator_3, denominator_3));

			numerator_1 = numerator_2;
			denominator_1 = denominator_2; 
			numerator_2 = numerator_3;
			denominator_2 = denominator_3; 
		}
	}
}

Element FareySequence::operator [] (int index) const
{
	return sequence_[index];
}

double FareySequence::operator () (int index) const
{
	return (double(sequence_[index].first) / sequence_[index].second);
}

ostream& operator << (ostream& out, FareySequence& farey)
{
	out << "(" << farey.sequence_[0].first << "/" << farey.sequence_[0].second;
	for ( vector<Element>::iterator ite=farey.sequence_.begin()+1;ite!=farey.sequence_
.end();++ite) 
	{
		out << "," << ite->first << "/" << ite->second;
	}
	out << ")";
}

int FareySequence::size()
{
	return sequence_.size();
}

— Preceding unsigned comment added by User:Rtomas (talkcontribs) 13:19, 5 February 2014

Historical accidents[edit]

It's "a historical accident" that they're called "Farey". Which makes me wonder, is there a section in half the pages on things named after Newton (for example), explaining it was merely "a historical accident" that they're named after him, as the Indians who discovered them centuries earlier were not known in the west? Something curious here. — Preceding unsigned comment added by 110.20.158.134 (talk) 09:10, 14 December 2015 (UTC)[reply]

Wikipedia:Wikipedia is a work in progress. Hyacinth (talk) 13:18, 18 May 2017 (UTC)[reply]

constructing FS from mediants?[edit]

mediant of a/b and c/d is (a+c)/(b+d)

so sequence starts:

0/1 1/1

0/1 1/2 1/1

0/1 1/3 1/2 2/3 1/1

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

Darcourse (talk) 06:17, 16 February 2018 (UTC)[reply]

just noticed the sequence is possibly not well-defined, for example 2/3 + 3/12 = 5/15 = 1/3, whereas 2/3 + 1/4 = 3/7 != 1/3.

a mediant spectrum could be (a+kc)/(b+kd) for c/d in lowest terms.

Darcourse (talk) 07:11, 16 February 2018 (UTC)[reply]

The sequence is very well defined. You can only apply the mediant between neighboring fractions. 2/3 and 1/4 are not Farey neighbous as 2*4-3*1 = 5, not 1. Rtomas (talk) 20:40, 7 June 2020 (UTC)[reply]

series vs. sequence[edit]

One can read near the end of the article:

rationals can often take advantage of the Farey series

but near the begining, one can read that the word "sequence" should be use in this context. Could some one clarify whether this is consistent? — Preceding unsigned comment added by 2001:6B0:E:2B18:0:0:0:80 (talk) 06:52, 1 January 2021 (UTC)[reply]

"Equivalent area" details[edit]

In https://en.wikipedia.org/w/index.php?title=Farey_sequence&type=revision&diff=1105657955&oldid=1104796601 I moved the Austin2008 article information into its own subsection. In its original location it broke the flow of the section. The quality of the discussion there doesn't live up to the original article, either, which made matters worse. — Preceding unsigned comment added by 98.225.50.10 (talk) 05:40, 21 August 2022 (UTC)[reply]

Error in the F_25 picture?[edit]

The initial terms of the Farey sequence with denominators up to 25 are as follows: 0/1, 1/25, 1/24, 1/23, 1/22, 1/21, 1/20, 1/19, 1/18, 1/17, 1/16, 1/15, 1/14, 1/13, 2/25, ...

The diagram agrees with the sequence until the term 1/14, then indicates the next fraction has denominator 25, which is not the case. There could be other mistakes, but I did not check the rest. I do not have the ability to fix this diagram, sorry, because the most reasonable option would be generating it using some code. — Preceding unsigned comment added by 63.216.63.70 (talkcontribs) 22:27, 8 May 2023 (UTC)[reply]

greater than/by 1[edit]

Every fraction has two continued fraction expansions — in one the final term is 1; in the other the final term is greater by 1.

That word by is a recent change from than, and I disapprove. Greater by 1 than what? Than the term that otherwise preceded the final 1, but that is not mentioned in the context. That the new final term exceeds 1 is also true. —Tamfang (talk) 05:00, 10 September 2023 (UTC)[reply]

unhappy symbol[edit]

I feel that |F| for the length of F is unhappy; at least a word of explanation seems in order. 151.29.137.229 (talk) 23:52, 24 September 2023 (UTC)[reply]