2018-10-10 22:03:03 +00:00
---
id: 5900f4951000cf542c50ffa8
2021-02-06 04:42:36 +00:00
title: 'Problem 297: Zeckendorf Representation'
2018-10-10 22:03:03 +00:00
challengeType: 5
2021-02-06 04:42:36 +00:00
forumTopicId: 301949
2021-01-13 02:31:00 +00:00
dashedName: problem-297-zeckendorf-representation
2018-10-10 22:03:03 +00:00
---
2020-12-16 07:37:30 +00:00
# --description--
2020-02-17 16:40:55 +00:00
2021-02-06 04:42:36 +00:00
Each new term in the Fibonacci sequence is generated by adding the previous two terms.
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
Starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89.
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
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.
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
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< n< 106, ∑ z(n) = 7894453.
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
Find ∑ z(n) for 0< n< 1017.
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
# --hints--
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
`euler297()` should return 2252639041804718000.
2018-10-10 22:03:03 +00:00
```js
2020-12-16 07:37:30 +00:00
assert.strictEqual(euler297(), 2252639041804718000);
2018-10-10 22:03:03 +00:00
```
2021-01-13 02:31:00 +00:00
# --seed--
## --seed-contents--
```js
function euler297() {
return true;
}
euler297();
```
2020-12-16 07:37:30 +00:00
# --solutions--
2020-08-13 15:24:35 +00:00
2021-01-13 02:31:00 +00:00
```js
// solution required
```