Fn
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.
The Farey sequence is sometimes incorrectly called a Farey series.
Each Farey sequence:
1
to 5
are:
n
. The function should have one parameter that is n
. It should return the sequence as an array.
farey
should be a function.
testString: assert(typeof farey === 'function');
- text: farey(3)
should return an array
testString: assert(Array.isArray(farey(3)));
- text: farey(3)
should return ["1/3","1/2","2/3"]
testString: assert.deepEqual(farey(3), ["1/3","1/2","2/3"]);
- text: farey(4)
should return ["1/4","1/3","1/2","2/4","2/3","3/4"]
testString: assert.deepEqual(farey(4), ["1/4","1/3","1/2","2/4","2/3","3/4"]);
- text: farey(5)
should return ["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]
testString: assert.deepEqual(farey(5), ["1/5","1/4","1/3","2/5","1/2","2/4","3/5","2/3","3/4","4/5"]);
```