// https://github.com/yangzj1992/FE-Questions/blob/master/codewars/5541f58a944b85ce6d00006a.Product%20of%20consecutive%20Fib%20numbers/Product%20of%20consecutive%20Fib%20numbers.md
export function fib(prod: number) {
  let n = 0;
  let nPlus = 1;

  while (n * nPlus < prod) {
    nPlus = n + nPlus;
    n = nPlus - n;
  }

  return [n, nPlus, n * nPlus === prod];
}

// console.log(fib(55), [21, 34, true]);
console.log(fib(714), [21, 34, true]);
// console.log(fib(800), [34, 55, false]);
