From aadd7ab5404e66c03b64384edccab79e2b6c9559 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sun, 31 Dec 2017 09:54:44 +0000 Subject: [PATCH] Travis build: 687 [ci skip] --- README.md | 2 +- docs/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 092a124a0..d02308743 100644 --- a/README.md +++ b/README.md @@ -2428,7 +2428,7 @@ const fibonacciUntilNum = num => { Examples ```js -fibonacciCountUntilNum(10); // 7 +fibonacciUntilNum(10); // [ 0, 1, 1, 2, 3, 5, 8 ] ``` diff --git a/docs/index.html b/docs/index.html index 22500c832..705c87cc6 100644 --- a/docs/index.html +++ b/docs/index.html @@ -470,7 +470,7 @@ collatz(5); // 16 [] ); }; -
fibonacciCountUntilNum(10); // 7
+
fibonacciUntilNum(10); // [ 0, 1, 1, 2, 3, 5, 8 ]
 

gcd

Calculates the greatest common divisor between two or more numbers/arrays.

The helperGcdfunction uses recursion. Base case is when y equals 0. In this case, return x. Otherwise, return the GCD of y and the remainder of the division x/y.

const gcd = (...arr) => {
   let data = [].concat(...arr);
   const helperGcd = (x, y) => (!y ? x : gcd(y, x % y));