Update fibsTillNum.md

This commit is contained in:
Soorena
2017-12-22 17:11:36 +03:30
committed by GitHub
parent bab21561aa
commit a5eae658bf

View File

@ -1,9 +1,10 @@
### fibsTillNum
Returns the number of fibonnacci numbers till num(0 and num inclusive)
Returns the number of fibonnacci numbers till num(0 and num inclusive).
```js
const fibsTillNum = num =>
Math.ceil(Math.log(num * Math.sqrt(5) + 1/2) / Math.log((Math.sqrt(5)+1)/2))// fibonacci(5) -> [0,1,1,2,3]
Math.ceil(Math.log(num * Math.sqrt(5) + 1/2) / Math.log((Math.sqrt(5)+1)/2))
// fibonacci(5) -> [0,1,1,2,3]
// fibsTillNum(10) -> 7
```