First, the problem defines the Fibonacci numbers, though very poorly. (There are lots of questions about the Fibonacci numbers on Codewars, so they are probably assuming you have seen it before).
Each term in the Fibonacci sequence is the sum of the previous two:
0 + 1 = 1
1 + 1 = 2
1 + 2 = 3
2 + 3 = 5
3 + 5 = 8
5 + 8 + 13
......
This can be written in the mathematical notation, F(0) = 0, F(1) = 1, F(n) = F(n-2) + F(n-1), which is also included in the problem.
So this is task (1): come up with code to compute the Fibonacci numbers. You want to be able to go from an n to an F(n). That means either writing a function F which when called with n returns the n-th Fibonacci number, or filling an array F with the Fibonacci numbers, where the nth index has the nth Fibonacci number.
Next, the problem says you need to be able to take a prod, and find an n such that F(n) * F(n + 1) = prod. This is task (2). If you think about this, it doesn't actually depend on the Fibonacci numbers at all -- it works on any sequence. So you can solve and test just this part of the problem using something simpler, maybe just the counting number 1, 2, 3, 4, ... or the squares 1, 2, 4, 9, 16, ..., or the odd numbers 1, 3, 5, ... etc.
Finally, you need to plug these two things together, which is task (3) and the simplest task.
The note at the bottom about the golden ratio is just a "hint", but it's not actually a useful hint. I would ignore it.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks Curtis. Here is a link to the problem codewars.com/kata/5541f58a944b85ce...
First, the problem defines the Fibonacci numbers, though very poorly. (There are lots of questions about the Fibonacci numbers on Codewars, so they are probably assuming you have seen it before).
Each term in the Fibonacci sequence is the sum of the previous two:
This can be written in the mathematical notation,
F(0) = 0
,F(1) = 1
,F(n) = F(n-2) + F(n-1)
, which is also included in the problem.So this is task (1): come up with code to compute the Fibonacci numbers. You want to be able to go from an
n
to anF(n)
. That means either writing a functionF
which when called withn
returns then
-th Fibonacci number, or filling an arrayF
with the Fibonacci numbers, where then
th index has then
th Fibonacci number.Next, the problem says you need to be able to take a
prod
, and find ann
such thatF(n) * F(n + 1) = prod
. This is task (2). If you think about this, it doesn't actually depend on the Fibonacci numbers at all -- it works on any sequence. So you can solve and test just this part of the problem using something simpler, maybe just the counting number1, 2, 3, 4, ...
or the squares1, 2, 4, 9, 16, ...
, or the odd numbers1, 3, 5, ...
etc.Finally, you need to plug these two things together, which is task (3) and the simplest task.
The note at the bottom about the golden ratio is just a "hint", but it's not actually a useful hint. I would ignore it.