Without using recursion and cycles, find the sum of the numbers of the Fibonacci series from 1 to n.
3 answers
The sum of elements up to n is just F (n + 2) - 1 . That is, you need to find the Fibonacci number one by one from the n- th and subtract one.
How to find the necessary Fibonacci number You have already written Stanislav.
|
This is done very simply using the Binet formula , which explicitly expresses the value of a number depending on its ordinal number in the Fibonacci series.
|
The very first identity is just what you need. The formula for the n-th member is written higher.
- So what's the point of the nth element? Need amount. - cy6erGn0m
|