Remove fibonacciCountUntilNum

This commit is contained in:
Angelos Chalaris
2020-04-16 11:02:33 +03:00
parent 31eb0269a8
commit 410f4443ca
2 changed files with 0 additions and 25 deletions

View File

@ -1,17 +0,0 @@
---
title: fibonacciCountUntilNum
tags: math,beginner
---
Returns the number of fibonnacci numbers up to `num`(`0` and `num` inclusive).
Use a mathematical formula to calculate the number of fibonacci numbers until `num`.
```js
const fibonacciCountUntilNum = num =>
Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));
```
```js
fibonacciCountUntilNum(10); // 7
```

View File

@ -1,8 +0,0 @@
const {fibonacciCountUntilNum} = require('./_30s.js');
test('fibonacciCountUntilNum is a Function', () => {
expect(fibonacciCountUntilNum).toBeInstanceOf(Function);
});
test('Returns the correct number', () => {
expect(fibonacciCountUntilNum(10)).toBe(7);
});