fibLogarithmic = number => {
  // Transforms [f_1, f_0] to [f_2, f_1] and so on.
  const nextFib = [[1, 1], [1, 0]];

  const matrixMultiply = (a, b) => [
    [
      a[0][0] * b[0][0] + a[0][1] * b[1][0],
      a[0][0] * b[0][1] + a[0][1] * b[1][1]
    ],
    [
      a[1][0] * b[0][0] + a[1][1] * b[1][0],
      a[1][0] * b[0][1] + a[1][1] * b[1][1]
    ]
  ];

  const transform = power(nextFib, number, matrixMultiply, [[1, 0], [0, 1]]);

  // [f_n, f_{n-1}] = Transform * [f_0, f_{-1}] = Transform * [0, 1]
  // Hence the result is the first row of Transform multiplied by [0, 1],
  // which is the same as transform[0][1].
  return transform[0][1];
}
Implementation based on matrix exponentiation.
O(log(n)) in time, O(1) in space

@param Number
@return Number