The Farey sequence is most easily generated through the use of what is known as the Stern Berchot method.
This method centers around the incorrect method of adding
fractions that many grade school, high school, and even some
college kids employ.
(a/b) + (c/d) = (a+c)/(b+d)
Starting with the
F1 case of 0/1 and 1/1, one simply adds two adjacent members of the sequence to generate the next level. An example is in order:
for n=1: 0/1, 1/1
n=2: 0/1, 0+1/1+1 (1/2), 1/1
n=3: 0/1, 0+1/1+2 (1/3), 1/2, 1+1/1+2 (2/3), 1/1
etc
If you're going to generate the sequence in a program, it's best to use two
list iterators, one behind the other, to generate the next level.