function getRadius(cycles, i) {
var sequence = fib.sequence(cycles.length);
- var total = fib.sum(cycles.length + 1);
+ var total = fib.sum(cycles.length);
var sum = fib.sum(i);
return center() - (center() * sum / total);
if (length === 0) { return 0; }
if (length === 1) { return 1; }
- return self.sequence(length).reduce(function (previous, current) {
+ return self.sequence(length + 1).reduce(function (previous, current) {
return previous + current;
}, 0);
};
it('returns the sum of a sequence', function () {
var fib = new tr.util.Fib();
- expect(fib.sum(6)).toEqual(12);
+ expect(fib.sum(5)).toEqual(12);
});
});