Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-297-zeckendorf-representation.md
gikf 47fc3c6761 fix(curriculum): clean-up Project Euler 281-300 (#42922)
* fix: clean-up Project Euler 281-300

* fix: missing image extension

* fix: missing power

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

* fix: missing subscript

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2021-07-22 12:38:46 +09:00

1.1 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f4951000cf542c50ffa8 Problem 297: Zeckendorf Representation 5 301949 problem-297-zeckendorf-representation

--description--

Each new term in the Fibonacci sequence is generated by adding the previous two terms.

Starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89.

Every positive integer can be uniquely written as a sum of nonconsecutive terms of the Fibonacci sequence. For example, 100 = 3 + 8 + 89.

Such a sum is called the Zeckendorf representation of the number.

For any integer n>0, let z(n) be the number of terms in the Zeckendorf representation of n.

Thus, z(5) = 1, z(14) = 2, z(100) = 3 etc.

Also, for 0 &lt; n &lt; {10}^6, \sum z(n) = 7\\,894\\,453.

Find \sum z(n) for 0 &lt; n &lt; {10}^{17}.

--hints--

zeckendorfRepresentation() should return 2252639041804718000.

assert.strictEqual(zeckendorfRepresentation(), 2252639041804718000);

--seed--

--seed-contents--

function zeckendorfRepresentation() {

  return true;
}

zeckendorfRepresentation();

--solutions--

// solution required