fix(formatting): Zeckendorf challenge | Rosetta code (#35474)
* fix(formatting): Zeckendorf challenge | Rosetta code * Update zeckendorf-number-representation.english.md
This commit is contained in:
committed by
Aditya
parent
6ae6e6fa05
commit
8bac073687
@ -6,36 +6,13 @@ challengeType: 5
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
<p>
|
||||
Just as numbers can be represented in a
|
||||
positional notation as sums of multiples of the powers of ten (decimal)
|
||||
or two (binary); all the positive integers can be represented as the sum
|
||||
of one or zero times the distinct members of the Fibonacci series.
|
||||
</p>
|
||||
<p>
|
||||
Recall that the first six distinct Fibonacci
|
||||
numbers are: <code>1, 2, 3, 5, 8, 13</code>. The decimal number eleven can
|
||||
be written as <code>0*13 + 1*8 + 0*5 + 1*3 + 0*2 + 0*1</code> or
|
||||
<code>010100</code> in positional notation where the columns represent
|
||||
multiplication by a particular member of the sequence. Leading zeroes are
|
||||
dropped so that 11 decimal becomes <code>10100</code>.
|
||||
</p>
|
||||
<p>
|
||||
10100 is not the only way to make 11 from the Fibonacci numbers however
|
||||
<code>0*13 + 1*8 + 0*5 + 0*3 + 1*2 + 1*1</code> or 010011 would also
|
||||
represent decimal 11. For a true Zeckendorf number there is the added
|
||||
restriction that ''no two consecutive Fibonacci numbers can be used''
|
||||
which leads to the former unique solution.
|
||||
</p>
|
||||
<p>
|
||||
Task:
|
||||
Write a function that generates and returns an array of first N Zeckendorf numbers in order.
|
||||
</p>
|
||||
Just as numbers can be represented in a positional notation as sums of multiples of the powers of ten (decimal) or two (binary); all the positive integers can be represented as the sum of one or zero times the distinct members of the Fibonacci series. Recall that the first six distinct Fibonacci numbers are: <code>1, 2, 3, 5, 8, 13</code>.
|
||||
The decimal number eleven can be written as <code>0*13 + 1*8 + 0*5 + 1*3 + 0*2 + 0*1</code> or <code>010100</code> in positional notation where the columns represent multiplication by a particular member of the sequence. Leading zeroes are dropped so that 11 decimal becomes <code>10100</code>. 10100 is not the only way to make 11 from the Fibonacci numbers however <code>0*13 + 1*8 + 0*5 + 0*3 + 1*2 + 1*1</code> or 010011 would also represent decimal 11. For a true Zeckendorf number there is the added restriction that <i>no two consecutive Fibonacci numbers can be used</i> which leads to the former unique solution.
|
||||
</section>
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
Write a function that generates and returns an array of the first <code>n</code> Zeckendorf numbers in order.
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
@ -92,7 +69,6 @@ const answer = range(1, 20).map(zeckendorf);
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
|
||||
|
||||
```js
|
||||
// zeckendorf :: Int -> String
|
||||
function zeckendorf(n) {
|
||||
|
Reference in New Issue
Block a user